Differences Between SuiteScript 1.0 and SuiteScript 2.1 Script Types

SuiteScript 2.1 supports the script types available in SuiteScript 1.0, but the two versions differ in script structure, entry point names, context objects, and APIs.

SuiteScript 2.1 also includes script types that have no SuiteScript 1.0 equivalent:

In SuiteScript 1.0, the term event types is used to describe how a script was triggered. In SuiteScript 2.1, standard script types use entry points. An entry point is a function that runs when a corresponding event or action occurs. In many cases, SuiteScript 2.1 entry points correspond to SuiteScript 1.0 event types, but the entry point function receives a context object instead of individual arguments.

Custom Tool scripts are an exception. Their available operations and input parameters are defined by a JSON-RPC schema rather than by a fixed set of standard entry points.

For more information about SuiteScript 2.1 entry points, see SuiteScript 2.x Entry Point Script Creation and Deployment.

See the following help topics for specific information about the differences in each script type:

For more information about specific SuiteScript 2.1 script types, see the following help topics:

Bundle Installation Script Type Differences

SuiteScript 2.1 bundle installation scripts use the beforeInstall, afterInstall, beforeUpdate, afterUpdate, and beforeUninstall entry points. These entry points replace the SuiteScript 1.0 bundle installation event functions.

The entry point context provides bundle-version information. The toversion parameter is available for installation and update entry points, and the fromversion parameter is available for update entry points. Review the applicable entry point API when converting scripts that rely on bundle-version values.

For more information about the bundle installation script type in SuiteScript 2.1, see SuiteScript 2.1 Bundle Installation Script Type.

Note:

SuiteBundler is still supported, but it will not be updated with any new features.

To take advantage of new features for packaging and distributing customizations, you can use the Copy to Account and SuiteCloud Development (SDF) features instead of SuiteBundler.

Copy to Account is an administrator tool that you can use to copy custom objects between your accounts. The tool can copy one custom object at a time, including dependencies and data. For more information, see Copy to Account.

SuiteCloud Development Framework is a development framework that you can use to create SuiteApps from an integrated development environment (IDE) on your local computer. For more information, see SuiteCloud Development Framework.

Client Script Type Differences

Here's how client scripts differ between SuiteScript 1.0 and 2.1:

  • In SuiteScript 2.1, a client script includes the parameter: currentRecord.

  • In SuiteScript 2.1, the fieldChanged entry point includes the parameter: column.

  • The type parameter in the SuiteScript 1.0 pageInit event type is called mode in the SuiteScript 2.1 pageInit entry point.

  • The recalc event type in SuiteScript 1.0 is the sublistChanged entry point in SuiteScript 2.1.

  • In SuiteScript 2.1, the validateDelete entry point includes the parameter: lineCount.

  • In SuiteScript 2.1, the validateField entry point includes the parameter: column.

  • SuiteScript 2.1 also includes the localizationContextEnter and localizationContextExit entry points.

SuiteScript 2.1 client scripts execute in the browser. Use language features that are supported by the browsers used in your account.

For more information about the client script type in SuiteScript 2.1, see SuiteScript 2.1 Client Script Type.

Custom Tool Script Type Differences

Custom Tool scripts have no SuiteScript 1.0 equivalent. They let external AI clients invoke NetSuite functionality through the NetSuite AI Connector Service.

Custom Tool scripts are deployed through SDF and use a JSON-RPC schema to define tool names, descriptions, and input parameters. The schema determines the operations available to an AI client.

For more information, see SuiteScript 2.1 Custom Tool Script Type.

Map/Reduce Script Type Differences

Map/Reduce scripts have no SuiteScript 1.0 equivalent. They are designed for processing large amounts of data that can be divided into small, independent parts.

A Map/Reduce script can include the following entry points:

  • getInputData

  • map

  • reduce

  • summarize

Use Map/Reduce scripts instead of scheduled scripts when processing large datasets that can benefit from parallel processing and staged execution.

For more information about the map/reduce script type in SuiteScript 2.1, see SuiteScript 2.1 Map/Reduce Script Type.

Mass Update Script Type Differences

Here's how mass update scripts differ between SuiteScript 1.0 and 2.1:

  • In SuiteScript 2.1, a mass update script includes the each entry point. There is no equivalent event type in SuiteScript 1.0.

  • The rec_type and rec_id parameters used in SuiteScript 1.0 mass update scripts are replaced with params.id and params.type parameters for the each entry point in SuiteScript 2.1.

For more information about the mass update script type in SuiteScript 2.1, see SuiteScript 2.1 Mass Update Script Type.

Portlet Script Type Differences

Here's how portlet scripts differ between SuiteScript 1.0 and 2.1:

  • In SuiteScript 2.1, you can use a portlet for a SuiteApp.

  • In SuiteScript 2.1, a portlet script includes the render entry point. There is no equivalent event type in SuiteScript 1.0.

  • The following methods are included in a SuiteScript 1.0 nlobjPortlet object, but are not included in the SuiteScript 2.1 Portlet object: setRefreshInterval(n), setScript(scriptId).

  • The following functions included in a SuiteScript 1.0 nlobjPortlet object are now properties in a SuiteScript 2.1 Portlet object:

    • The setHtml(html) function in SuiteScript 1.0 is the Portlet.html

      property in SuiteScript 2.1.

    • The setTitle(title) function in SuiteScript 1.0 is the Portlet.title

      property in SuiteScript 2.1.

  • The parameters for the nlPortletObject.addcolumn method have different names in the Portlet.addColumn method in SuiteScript 2.1:

    • The name parameter in SuiteScript 1.0 is the id

      parameter in SuiteScript 2.1.

    • The just parameter in SuiteScript 1.0 is the align

      parameter in SuiteScript 2.1.

  • The Portlet.addEditColumn method in SuiteScript 2.1 has the parameters: link, linkParam, and linkParamName.

  • The name parameter for the SuiteScript 1.0 nlPortletObject.addField method is id in the SuiteScript 2.1 Portlet.addField method.

  • The indent parameter for the SuiteScript 1.0 nlPortletObject.addLine method is now called align in the SuiteScript 2.1 Portlet.addField method.

  • SuiteScript 2.1 portlet scripts include the properties: Portlet.clientScriptFileId and Portlet.clientScriptModulePath.

For more information about the portlet script type in SuiteScript 2.1, see SuiteScript 2.1 Portlet Script Type.

RESTlet Script Type Differences

SuiteScript 2.1 RESTlets use the delete, get, post, and put entry points. These entry points are equivalent to the delete, get, put, and post functions (http methods) in SuiteScript 1.0.

A RESTlet must expose an entry point that matches the HTTP method used to call it. Depending on the method, input can be provided in the URL or request body. RESTlet calls require authentication.

For more information about error handling with RESTlet scripts, see SuiteScript 2.1 RESTlet Error Handling.

For more information about the client script type in SuiteScript 2.1, see the help topic SuiteScript 2.1 RESTlet Script Type.

Scheduled Script Type Differences

Here's how scheduled scripts differ between SuiteScript 1.0 and 2.1:

  • In SuiteScript 2.1, a scheduled script uses the execute entry point. There is no equivalent event type in SuiteScript 1.0.

  • The SuiteScript 1.0 nlapiScheduleScript function is replaced with the SuiteScript 2.1 task.create(options) and task.ScheduledScriptTask.

  • The type parameter in the SuiteScript 1.0 nlapiScheduledScript method is replaced with the context.InvocationType enum in SuiteScript 2.1. The values are similar: SCHEDULED, ON_DEMAND, USER_INTERFACE, ABORTED, and SKIPPED.

  • The nlapiSetRecoverPoint function in SuiteScript 1.0 has no SuiteScript 2.1 equivalent. The functionality provided by this function is not needed because of the way scheduled scripts execute in SuiteScript 2.1.

  • The nlapiYieldScript function in SuiteScript 1.0 has no SuiteScript 2.1 equivalent. The functionality provided by this function is not needed because of the way scheduled scripts execute in SuiteScript 2.1.

For more information about the scheduled script type in SuiteScript 2.1, see SuiteScript 2.1 Scheduled Script Type.

SDF Installation Script Type Differences

SDF installation scripts have no SuiteScript 1.0 equivalent. The SDF installation script type performs setup, configuration, validation, and data management tasks when an SDF SuiteApp project is deployed to a target account.

For more information about the SDF installation script type in SuiteScript 2.1, see SuiteScript 2.1 SDF Installation Script Type.

Suitelet Script Type Differences

SuiteScript 2.1 Suitelets use the onRequest entry point. There is no equivalent event type in SuiteScript 1.0.

Suitelets run on the server in response to HTTP GET or POST requests. The params object provides request and response objects for processing the request and building the response.

For more information about the Suitelet script type in SuiteScript 2.1, see SuiteScript 2.1 Suitelet Script Type.

User Event Script Type Differences

Here's how user event scripts differ between SuiteScript 1.0 and 2.1:

  • The beforeLoad entry point in SuiteScript 2.1 includes the parameter: newRecord.

  • The beforeSubmit entry point in SuiteScript 2.1 includes the parameters: oldRecord and newRecord.

  • The afterSubmit entry point in SuiteScript 2.1 includes the parameters: oldRecord and newRecord.

  • The type parameter in each entry point in SuiteScript 2.1 is now set using the context.UserEventType enum.

For more information about the user event script type in SuiteScript 2.1, see SuiteScript 2.1 User Event Script Type.

Workflow Action Script Type Differences

Here's how workflow action scripts differ between SuiteScript 1.0 and 2.1:

  • In SuiteScript 2.1, a workflow action script includes the onAction entry point. There is no equivalent event type in SuiteScript 1.0.

  • The id parameter in SuiteScript 1.0 is workflowId in SuiteScript 2.1.

  • There are two parameters in SuiteScript 2.1: newRecord and oldRecord.

For more information about the workflow action script type in SuiteScript 2.1, see SuiteScript 2.1 Workflow Action Script Type.

Related Topics

General Notices