Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
nlobjRecord.insertLineItem issues
I've been trying to insert a line item (insurance cost) after the user clicks on Save on a transaction. First, I did it with a client script, but the sync issues were too constricting. So I then moved to a User Event script (beforeSubmit). Here is the code:
function beforeSubmit() {
addInsuranceLine();
}
function addInsuranceLine() {
var record = nlapiGetNewRecord();
record.insertLineItem('item', record.getLineItemCount('item'));
record.setLineItemValue('item', 'item', record.getLineItemCount('item'), 21);
record.setLineItemValue('item', 'quantity', record.getLineItemCount('item'), 1);
record.setLineItemValue('item','rate', record.getLineItemCount('item'), 0.01);
record.setLineItemValue('item','amount', record.getLineItemCount('item'), 0.01);
}
Note that 21 is the internal ID of the item I want to add.