mg2017
07/07/2020, 3:30 PMmg2017
07/07/2020, 5:48 PMfor (var j = 0; j < record.length; j++) {
var internal_id = record[j].getValue('internalid');
var so = nlapiLoadRecord('salesorder', internal_id);
var line = so.getLineItemCount('item');
for (var i = 1; i <= line; i++) {
var tax_code = so.getLineItemValue('item', 'taxcode', i);
console.log('Line Tax ID Is: ' + tax_code);
so.selectLineItem('item', i);
if(tax_code == 22142) {
so.setCurrentLineItemValue('item', 'taxcode', '27489');
so.commitLineItem('item');
nlapiSubmitRecord(so);
}
}
}
Full loop running in console. Internal Id should be 5 character length but the tax code it's printing is 4 character length - no idea why