KM
05/05/2026, 1:34 PMCeligo AI
05/05/2026, 1:34 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To add new lines to a sales order using SuiteScript, you can use the
selectNewLine and setCurrentSublistValue methods in a user event script. Here is a sample code snippet:
javascript
tranRec.selectNewLine({sublistId:'item'});
tranRec.setCurrentSublistValue({sublistId:'item',fieldId:'item',value:item});
tranRec.setCurrentSublistValue({sublistId:'item',fieldId:'quantity',value:quantity});
tranRec.commitLine({sublistId:'item'});
However, if you're working on the client side, you might need to use forceSyncSourcing to commit the line after the item is done sourcing.
For a before submit user event script, you only need to use setSublistValue on the next available line. You don't need to insert the line unless you actually want to insert a line at the first line.
For an after submit user event script, you need to load the record again and save it to make your changes. But keep in mind that this could potentially double your sales order save times.
Please note that these methods are part of the SuiteScript API and you should refer to the official NetSuite documentation for more details and usage guidelines.Celigo AI
05/05/2026, 1:34 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824157715
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820556641
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820373535
Celigo AI
05/05/2026, 1:34 PM