SuiteScript API

This topic applies to

Applies to

SuiteCommerce | SuiteCommerce Advanced


SuiteScript is a JavaScript API that enables you to programmatically access most NetSuite records, custom records, and event/trigger points. This API is a standard NetSuite feature. For complete details on all of SuiteScript including all APIs and the usage of those APIs, see the help topic SuiteScript 1.0.

SuiteCommerce and Suitecommerce Advanced use SuiteScript to access data stored in a NetSuite record. This enables Commerce web stores to access data that is not accessible from the Item Search API or the Commerce API.


SuiteCommerce and SuiteCommerce Advanced are being migrated to SuiteScript 2.0 in an ongoing effort that will span multiple releases. The migration to SuiteScript 2.0 will ultimately enable Commerce application developers to interact with core NetSuite records in a unified way. To learn more about this effort and to see status updates, including a list of migrated modules, refer to Commerce Migration to SuiteScript 2.0. For more information about SuiteScript 2.0, see the help topic SuiteScript 2.0 API Introduction.

Commerce web stores use SuiteScript in the following contexts:

  • Backend models: all backend models are combined into a file called ssp_libraries.js. This file is stored in the root directory of the SSP application.

  • Services: all services in SuiteCommerce and SuiteCommerce Advanced are deployed to the services directory within the SSP application.

Being installed within the SSP application enables backend models and services to access the SuiteScript API to access data stored in NetSuite records.

The Case application module, for example, uses SuiteScript to access information stored in a NetSuite case record. When creating a new case, Case.Model uses the following code:

var case_record = nlapiCreateRecord('supportcase');

The string passed to the nlapiCreateRecord method is the internal identifier for the case record in NetSuite. Calling nlapiCreateRecord creates a new case record in NetSuite. It also returns a copy of the object. This object is stored in the case_record variable.

Storing a record as an object enables you to call additional methods on the object containing the case record. For example, the following code calls the getField method that returns the value of the record field passed to the method.:

var category_field = case_record.getField('category');

In this example, getField returns the value of the category field.

Other modules use the nlapiLoadRecord method to assign a NetSuite record to a variable containing an object. You can then call methods like getField on the object to retrieve the values of specific fields within the record.

In another context, a model may call the nlapiDeleteRecord method to remove a record from NetSuite.