Reputation: 55
I am trying to make custom mass update on netsuite with JS script but its not working.
Code:
function updateDepartment(rec_type, rec_id)
{
var transaction = nlapiLoadRecord(rec_type, rec_id);
transaction.setLineItemValue ('item','department', nlapiGetContext().getSetting('SCRIPT','custscript_dept_update'));
nlapiSubmitRecord(transaction, false, true);
}
Upvotes: 2
Views: 2250
Reputation: 15447
nlobjRecord.setLineItemValue needs a line number. You'd need to do something like:
var dept = nlapiGetContext().getSetting('SCRIPT','custscript_dept_update');
for(var i = transaction.getLineItemCount('item'); i> 0; i--){
transaction.setLineItemValue('item', 'department', i, dept);
}
Upvotes: 4