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.

SuiteScript 2.x Map/Reduce Script Type

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. .

SuiteScript 2.x Mass Update Script Type

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.

SuiteScript 2.x Portlet Script Type

Dashboard Portlets

RESTlet

Used to import data into NetSuite or export data from NetSuite. A RESTlet is called from an external application or from within NetSuite.

SuiteScript 2.x RESTlet Script Type

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.

SuiteScript 2.x Scheduled Script Type

Suitelet

Used to create custom NetSuite pages and perform backend processing. Suitelets are typically executed when an http.get or http.put request is received.

SuiteScript 2.x Suitelet Script Type

User Event

The user event script is one of the most commonly used script types. It can be used to perform processing, such as:

  • Determine what data is displayed on the NetSuite page in the user’s browser and how it is displayed

  • Determine what data is returned to another requesting server script, a web services client (for example, SOAP or REST), or a CSV import

  • Validate user data and process data written to the database

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.

SuiteScript 2.x User Event Script Type

Workflow Action

Used to create custom workflow actions.

SuiteScript 2.x Workflow Action Script Type

SuiteFlow (Workflow)

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.

General Notices