SuiteScript 1.0 to 2.1 reference

nlapiLogExecution in SuiteScript 2.1

In SuiteScript 2.1, nlapiLogExecution is replaced by log.debug / log.audit / log.error from N/log. Writes to the script execution log.

Before and after

// SuiteScript 1.0
nlapiLogExecution('AUDIT', 'Credit hold', 'Order ' + id);
// SuiteScript 2.1
define(['N/log'], (log) => {
  log.audit({ title: 'Credit hold', details: 'Order ' + id });
});

What to watch for

  • The level argument becomes the method: DEBUG, AUDIT, ERROR and EMERGENCY map to log.debug, log.audit, log.error and log.emergency.
  • Objects passed as details are serialised to JSON automatically.

Related functions

Find what still needs converting

Find every script that still calls nlapiLogExecution

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.