SuiteScript Script Type and Execution Overview
There are two script execution categories in SuiteScript: those that run on the client’s browser (client scripts) and those that run on the NetSuite server (server scripts). There is one client script type (client) and several server script types (map/reduce, mass update, portlet, RESTlet, scheduled, Suitelet, user event, workflow action, bundle installation, and SDF installation). Some script types execute asynchronously (map/reduce, scheduled, and workflow action), while all other script types execute synchronously.
The documentation for each SuiteScript module indicates whether module members can be used in a client script, a server script, or both.
Client Scripts
A client script affects how and what type of data is shown on a NetSuite page. It is deployed either on a single record, on multiple records, or on a form. A client script can execute any time the user accesses a specific record or a specific form, such as creating a new record or updating an existing record. A client script can also execute as the page is loaded into the browser and any time the user enters or updates data on the page, and when they submit the page. The client script is one of the most commonly used script types. For more information, see SuiteScript 2.x Client Script Type.
Server Scripts
A server script provides general processing and saving of data, based on its type:
Server Script Type |
Purpose |
Additional Information |
---|---|---|
Map/Reduce |
Used to process large amounts of data across one or more records using the map/reduce paradigm to gather all the data then process it in a series of stages. The map/reduce script can be executed on demand or on a predetermined schedule. |
|
Mass Update |
Used to perform custom updates to record fields that are not available through general mass updates. Mass/update scripts are executed on demand only using the Perform Update button on the Mass Update Results Preview page; they cannot be automatically executed based on a deployment or schedule. . |
|
Portlet |
Used to create a custom portlet on a user’s dashboard. Portlet scripts run on the server, but the portlet is rendered on the user’s browser. |
|
RESTlet |
Used to import data into NetSuite or export data from NetSuite. A RESTlet is called from an external application or from within NetSuite. |
|
Scheduled |
Used to perform actions based on a specific schedule. Scheduled scripts can be executed on demand, or in the future according to a schedule, and can be set to execute on a recurring basis. |
|
Suitelet |
Used to create custom NetSuite pages and perform backend processing. Suitelets are typically executed when an |
|
User Event |
The user event script is one of the most commonly used script types. It can be used to perform processing, such as:
A user event script can be deployed on a single record or on multiple records and is executed any time the record is created, loaded, copied, deleted, or submitted. |
|
Workflow Action |
Used to create custom workflow actions. |
Two additional server script types are available but are only executed when installing a bundle or SuiteCloud project. These script types can perform actions or tasks (setup, configuration, and data management tasks) typically performed by an administrator. The main difference between the two script types is where and how they are deployed.
-
The bundle installation script is used to perform actions before or after a bundle is installed or updated, or before the bundle is uninstalled. Bundle installation scripts are included in a bundle and are deployed as part of the bundle. See SuiteScript 2.x Bundle Installation Script Type for more information about the bundle installation script.
-
The SDF installation script is used to perform actions during the deployment of a SuiteApp from SuiteCloud Development Framework (SDF). An SDF installation script can be incorporated into a SuiteApp deployment, or a SuiteApp project can include an SDF installation script that is automatically executed when the SuiteApp is deployed. See SuiteScript 2.x SDF Installation Script Type for more information SDF installation scripts.