SuiteScript 1.0 and SuiteScript 2.1 Script Structure Differences

SuiteScript 2.1 changes how scripts declare their type, identify callable functions, and receive context-specific information from NetSuite. Review these differences before you update a SuiteScript 1.0 script.

This topic covers the following sections:

Script Structure, Entry Points, Entry Point Functions

Most SuiteScript 2.1 script types have one or more entry points specific to that type. An entry point is where NetSuite gives your script control of the application. When you include an entry point, you tell NetSuite to execute a function in your script. This function is an entry point function.

For many script types, entry points correspond to events that trigger the script. For example, pageInit and fieldChanged are client script entry points for events that can occur during a browser session. Scheduled scripts have one entry point: execute. NetSuite calls it when a schedule runs the script or a user runs it manually.

For more information, see the following topics:

Context Objects

SuiteScript 2.1 entry point scripts use entry points to identify the functions NetSuite invokes for specific events or actions. Custom modules use entry points to identify the functions that other scripts can call. In both cases, entry points usually correspond to functions called entry point functions.

Most entry point functions have access to a context object. The context object provides data and lets the script take actions based on the context in which it runs.

For more information about context objects, see Context Objects in Entry Point and Custom Module Scripts.

JSDoc

SuiteScript 2.1 uses JSDoc comments to identify scripts and provide metadata. For entry point scripts, the @NApiVersion tag specifies the SuiteScript version and the @NScriptType tag identifies the script type. You can also use JSDoc tags to document your code.

For more information, see SuiteScript 2.1 JSDoc Validation.

Related Topics

General Notices