SuiteScript 1.0 to 2.1 reference
nlapiSetFieldValue in SuiteScript 2.1
In SuiteScript 2.1, nlapiSetFieldValue is replaced by setValue from N/currentRecord or context.newRecord. Sets a field on the current record.
Before and after
// SuiteScript 1.0
nlapiSetFieldValue('custbody_hold', 'T');// SuiteScript 2.1
context.currentRecord.setValue({ fieldId: 'custbody_hold', value: true });What to watch for
- Checkbox values are true and false, not 'T' and 'F'.
- To skip field-changed events as 1.0's firefieldchanged = false did, pass ignoreFieldChange: true.
Related functions
- nlapiGetFieldText becomes getText
- nlapiGetLineItemCount becomes getLineCount
- nlapiGetLineItemValue becomes getSublistValue
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiSetFieldValue
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.