I am trying to write a client script that will go ...
# suitescript
r
I am trying to write a client script that will go through every line of inventory detail on item receipt and would return error when bin number is empty but quantity field is entered. I am trying the following but I keep getting 'SSS_INVALID_SUBLIST_OPERATION CurrentRecord.getSublistValue' error. I have already tried other methods like currentRecord.getSubrecord, currentRecord.getSublistText, currentRecord.getText, currentRecord.getValue and currentRecord.getCurrentSublistSubrecord but none of them worked. Please help....Thanks define(['N/record','N/search','N/ui/dialog'], function (record, search, dialog) { /** *@NApiVersion 2.0 *@NScriptType ClientScript */ function saveRecord(context) { var currentRecord = context.currentRecord; var bincount = currentRecord.getValue({ fieldId: 'custbody_cnt_bin_dtl' }); if (bincount >= 1) { //return error //throw 'Cannot leave bin empty here...'; dialog.alert({ title: 'Warning', message: 'Bin number cannot be empty on inventory detail, please update the record !!' }); } } return { saveRecord: saveRecord } });
b
then branch from there
r
Thanks, it seems to be working. I now just need to count the number of entries in the subrecord to scan through all of them. Can you please help in getting the right function to count the subrecord entries? I have already tried getlinecount and record.count
I just want to loop through all the records to find if there is any without the bin and throw an error there
b
CurrentRecord.getLineCount should have done it
what did your code look like