SuiteScript 1.0 to 2.1 reference
nlapiSetLineItemValue in SuiteScript 2.1
In SuiteScript 2.1, nlapiSetLineItemValue is replaced by setSublistValue from N/record. Sets a value on a sublist line of a record in standard mode.
Before and after
// SuiteScript 1.0
rec.setLineItemValue('item', 'quantity', 1, 5);// SuiteScript 2.1
rec.setSublistValue({ sublistId: 'item', fieldId: 'quantity', line: 0, value: 5 });What to watch for
- Line 1 in 1.0 is line 0 in 2.1.
- On a dynamic record, use selectLine, setCurrentSublistValue and commitLine instead.
Related functions
- nlapiSelectNewLineItem becomes selectNewLine
- nlapiGetNewRecord becomes context.newRecord
- nlapiLogExecution becomes log.debug / log.audit / log.error
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiSetLineItemValue
SuiteMigrate lists the active 1.0 and 2.0 scripts in your NetSuite account, shows which ones you can read and which are locked, and drafts 2.1 conversions you review before deploying. Free for 5 conversions.
Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.