Methods of Deploying a Script
To run an entry point script in your NetSuite account, you must create a script deployment for it that determines how and when the script runs. You can create a script deployment in any of the following ways:
-
Using the Deployments subtab on the script record (see Work with the Deployments Subtab/Sublist).
-
Using the script deployment record (see Use the Script Deployment Record).
-
Using N/record module methods (see Use N/record Module Methods).
In most cases, you can also use the above methods to edit a script deployment.
Work with the Deployments Subtab/Sublist
You can deploy a script when you create a script record by using the Deployments subtab on the script record page. This approach lets you define values for many deployment fields, although not all. For some script types, you can also use the Deployments subtab when you are editing an existing script record. However, for other script types, the Deployments subtab is read-only when you are editing the script record. For more information about using the Deployment sublist, see Deploying a Script by using the Deployments Sublist.
Use the Script Deployment Record
You can deploy a script by using the script deployment record. You may want to use this approach for the following reasons:
-
The script deployment record lets you access a greater number of fields than the Deployments sublist.
-
If you have already created a script record, in some cases it is not possible to edit the Deployments sublist.
For more information about using the script deployment record, see Deploying a Script by using the Script Deployment Record.
Use N/record Module Methods
You can create a deployment programmatically by using the record.create(options) method in a script. When creating a script deployment record, set the options.type
parameter to record.Type.SCRIPT_DEPLOYMENT
. Similarly, if you can want to modify a script deployment record programmatically, you can load it by using record.load(options). You can also modify an existing deployment record by using other N/record Module methods.
For help with the field IDs available on the script deployment record, refer to the SuiteScript Records Browser.