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
}
});