My Restlet should either add or update an invoice with the line items. The add bit works - invoice + line items, but the update doesn't appear to add a new line item. Code looks like this:
update_record = nlapiLoadRecord('invoice', invoice_id)
var itemcount = update_record.getLineItemCount('item');
for (var i = 0; itemcount != null && i < itemcount; i++) {
if (jsonobject.item[i].item) {
update_record.setLineItemValue('item', 'item', i + 1, jsonobject.item[i].item)
}
}
var id = nlapiSubmitRecord(update_record, true);
nlapiLogExecution('DEBUG', 'id = ', id)
return id;
Instead of setLineItemValue
, try using the series of selectLineItem
, setCurrentLineItemValue
, and commitLineItem
methods. setLineItemValue
is not supported in all scenarios or on all fields.
See the NS Help article titled nlobjRecord
for details on all of these methods.