SuiteScript 2.x Modules

SuiteScript 2.x APIs are organized into various modules, based on behavior. The following table lists each module and provides a description, the supported script types, and permissions associated with the module. See Setting Roles and Permissions for SuiteScript for more information about permissions.

Note:

As a best practice, you should load only the modules that are needed by your script. However, you can load all SuiteScript 2.x modules at one time by passing the modules’ parent directory to the define() statement and its callback function: define(['N'], function(N) {...});. This is a convenient way to load all modules, however, doing so will sacrifice the performance advantage of loading only the modules that are needed. We provide this feature so that you can test and familiarize yourself with SuiteScript 2.x. You should not load all modules when using a production environment.

Module

Description

Supported Script Types*

Permissions

N/action Module

Load the N/action module to execute business logic to update the state of a record. Action APIs emulate NetSuite user interface buttons.

Client and server scripts

N/auth Module

Load the N/auth module to change your NetSuite login credentials.

Server scripts

N/cache Module

Load the N/cache module to enable the caching of needed data and improve performance.

Server scripts

N/certificateControl Module

Load the N/certificateControl module to enable scripting access to the Digital Certificates list found at Setup > Company > Certificates. You can use this module to find the correct certificate for a subsidiary and check the file type. For more information, see Digital Signing and Uploading Digital Certificates.

Server scripts

Certificate Management

N/commerce Modules

Load modules in the N/commerce namespace to access different assets in the web store context, such as items and shopping cart. The modules within the N/commerce namespace are supported by the latest version of SuiteCommerce and by SuiteCommerce Advanced 2019.2 onwards.

Client and server scripts

N/compress Module

Load the N/compress module to compress, decompress, and archive files.

Server scripts

N/config Module

Load the N/config module to access NetSuite configuration settings. See config.Type for a list of supported configuration pages.

Server scripts

N/crypto Module

Load the N/crypto module to work with hashing, hash-based message authentication (hmac), and symmetrical encryption. You can access a set of wrappers for OpenSSL's hash, hmac, cipher, and decipher methods.

Server scripts

N/crypto/certificate Module

Load the N/certificate module to sign XML documents or strings with digital certificates using asymmetric cryptography. In addition to signing XML documents, you can create signer and verifier objects and verify signed documents with this module.

Server scripts

Certificate Access

N/crypto/random Module

Load the N/crypto/random module to work with cryptographically-secure pseudo-random generator methods.

Client and server scripts

-

N/currency Module

Load the N/currency module to work with exchange rates within your NetSuite account. You can use this module to find the exchange rate between two currencies based on a certain date.

Client and server scripts

N/currentRecord Module

Load the N/currentRecord module to access the record instance that you are currently working on. You can then use the record instance in a client context.

Client scripts

N/dataset Module

Load the N/dataset module to create and manage datasets in SuiteAnalytics Workbook. Use this module with the N/workbook module to manage all aspects of your datasets and workbooks in SuiteAnalytics Workbook.

Server scripts

SuiteAnalytics Workbook

N/email Module

Load the N/email module to send email messages from within NetSuite. You can use the email module to send regular, bulk, and campaign email.

Client and server scripts

N/encode Module

Load the N/encode module to convert a string to another type of encoding. See encode.Encoding for a list of supported character set encoding.

Server scripts

N/error Module

Load the N/error module to create your own custom SuiteScript errors. Use these custom errors in try-catch statements to abort script execution.

Server scripts

N/file Module

Load the N/file module to work with files in NetSuite.

Server scripts

N/format Module

Load the N/format module to convert strings into a specified format and to parse formatted data into strings.

Client and server scripts

N/format/i18n Module

Load the N/format/i18n module to format currency.

Client and server scripts

N/http Module

Load the N/http module to make http calls.

Client and server scripts

N/https Module

Load the N/https module to make https calls. You can also use this module to encode binary content or securely access a handle to the value in a NetSuite credential field.

Client and server scripts

N/https/clientCertificate Module

Load the N/clientCertificate module to send SSL requests with a digital certificate.

Server scripts

Certificate Access

N/keyControl Module

Load the N/keyControl module to access key storage.

Server scripts

Key Management

N/log Module

Load the N/log module to access methods for logging script execution details. Module members are also supported by the global log Object.

Client and server scripts

N/piremoval Module

Load the N/piremoval module to remove personal information (PI) from system notes, workflow history, and specific field values.

Server scripts

Remove Personal Information Create

Remove Personal Information Run

N/plugin Module

Load the N/plugin module to load custom plug-in implementations.

Server scripts

N/portlet Module

Load the N/portlet module to resize or refresh a form portlet.

Client scripts

N/query Module

Load the N/query module to create and run searches using the SuiteAnalytics Workbook query process.

Client and server scripts

SuiteAnalytics Workbook

N/record Module

Load the N/record module to work with NetSuite records.

Client and server scripts

N/recordContext Module

Load the N/recordContext module to get the context type of a record.

Client and server scripts

N/redirect Module

Load the N/redirect module to redirect users to a URL, a Suitelet, a record, a task link, a saved search, or an unsaved search.

Server scripts

N/render Module

Load the N/render module to create forms or email from templates and to print to PDF or HTML.

Server scripts

Advanced PDF/HTML Templates

Custom PDF Layouts

N/runtime Module

Load the N/runtime module to access runtime settings for company, script, session, system, user, or version.

Client and server scripts

 

N/scriptTypes/restlet Module

Load the N/scriptTypes/restlet module to create custom handling for your RESTlet script.

RESTlet scripts

N/search Module

Load the N/search module to create and run on-demand or saved searches and analyze and iterate through the search results. You can search for a single record by keywords, create saved searches, search for duplicate records, or return a set of records that match filters you define.

Client and server scripts

Perform Search

Persist Search

Publish Search

N/sftp Module

Load the N/sftp module to connect to a remote FTP server using SFTP and transfer files.

Server scripts

Key Access (needed when public key authentication is used)

N/sso Module

Load the N/sso module to generate outbound single sign-on (SuiteSignOn) tokens.

Client and server scripts

N/suiteAppInfo Module

Load the N/suiteAppInfo module when you want to access information related to SuiteApps and Bundles.

Client and server scripts

N/task Module

Load the N/task module to create tasks and place them in the internal NetSuite scheduling or task queue. Use this module to schedule scripts, run Map/Reduce scripts, import CSV files, merge duplicate records, and execute asynchronous workflows.

Server scripts

Tasks

N/task/accounting/recognition Module

Load the task/accounting/recognition module to merge revenue arrangements or revenue elements. This module lets you combine revenue arrangements or revenue elements from multiple sources to represent a single contract for revenue allocation and recognition.

Server scripts

(Transactions) Revenue Arrangement

N/transaction Module

Load the N/transaction module to void transactions.

Client and server scripts

N/translation Module

Load the N/translation module to load NetSuite Translation Collections in SuiteScript.

Client and server scripts

N/ui/dialog Module

Load the N/dialog module to create a modal dialog that is displayed until a button on the dialog is pressed.

Client scripts

N/ui/message Module

Load the N/message module to display a message at the top of the screen under the menu bar.

Client scripts

N/ui/serverWidget Module

Load the N/serverWidget module to work with the user interface within NetSuite.

Server scripts

N/url Module

Load the N/url module to determine URL navigation paths within NetSuite or format URL strings.

Client and server scripts

N/util Module

Load the N/util module to manually access util methods. Module members are also supported by the global util Object.

Client and server scripts

N/workbook Module

Load the N/workbook module to create and manage workbooks in SuiteAnalytics Workbook. Use this module with the N/dataset module to manage all aspects of your datasets and workbooks in SuiteAnalytics Workbook.

Server scripts

SuiteAnalytics Workbook

N/workflow Module

Load the N/workflow module to initiate new workflow instances or trigger existing workflow instances.

Server scripts

Workflow

N/xml Module

Load the N/xml module to validate, parse, read, and modify XML documents.

Client and server scripts

* If you include a module in a script that is not a supported script type, an execution error will occur. This error may be UNEXPECTED_ERROR or INSUFFICIENT_PERMISSION or another error that indicates the method in the module could not be executed.

General Notices