SuiteScript 1.0 to 2.1 reference

nlapiGetLineItemCount in SuiteScript 2.1

In SuiteScript 2.1, nlapiGetLineItemCount is replaced by getLineCount from N/currentRecord or N/record. Counts the lines on a sublist.

Before and after

// SuiteScript 1.0
var lines = nlapiGetLineItemCount('item');
// SuiteScript 2.1
const lines = rec.getLineCount({ sublistId: 'item' });

What to watch for

  • Takes an options object with sublistId. Combine it with 0-based line indexes when looping.

Related functions

Find what still needs converting

Find every script that still calls nlapiGetLineItemCount

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.