SuiteScript 1.0 to 2.1 reference

nlapiGetFieldValue in SuiteScript 2.1

In SuiteScript 2.1, nlapiGetFieldValue is replaced by getValue from N/currentRecord or context.newRecord. Reads a field on the current record in a client or user event script.

Before and after

// SuiteScript 1.0
var entity = nlapiGetFieldValue('entity');
// SuiteScript 2.1
// Client script
const fieldChanged = (context) => {
  const entity = context.currentRecord.getValue({ fieldId: 'entity' });
};

// User event script
const beforeSubmit = (context) => {
  const entity = context.newRecord.getValue({ fieldId: 'entity' });
};

What to watch for

  • There is no global current record in 2.1. Read it from the entry point's context.
  • Values are typed: checkboxes are booleans, dates are Date objects, numbers are numbers.

Related functions

Find what still needs converting

Find every script that still calls nlapiGetFieldValue

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.

Add to Chrome — freeRead the migration guide

Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.