I’m attempting to uncheck a checkbox on the Sales Order transaction during line item entry if the location is a specific ID, I have tested with console.log() and confirmed I’m able to see the value, but for some reason when I attempt to set the value it won’t work.
I’ve tried a number of recommended answers but nothing has worked so far, here is my script:
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(['N/action', 'N/currentRecord', 'N/record', 'N/transaction'],
/**
* @param{action} action
* @param{currentRecord} currentRecord
* @param{record} record
* @param{transaction} transaction
*/
function(action, currentRecord, record, transaction) {
/**
* Function to be executed after sublist is inserted, removed, or edited.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
*
* @since 2015.2
*/
function sublistChanged(scriptContext) {
var recLoc = scriptContext.currentRecord.getValue('location');
if(recLoc == 79) {
var line = nlapiGetLineItemCount('item');
nlapiSetLineItemValue('item','createwo',line,'F');
};
}
return {
sublistChanged: sublistChanged
};
});
I appreciate any insight!