Creating a Script Record

The process of creating a script record varies depending on the script’s type. The following procedure shows general steps that apply to all script types. For certain script types, additional steps may be required.

To create a script record:

  1. Go to Customization > Scripting > Scripts > New.

    The system displays the Upload Script File page.

  2. In the Script File list, select the appropriate SuiteScript (.js) file. The list shows all versions of SuiteScript script files that you have uploaded to your File Cabinet.

    If the file you want to use has not been uploaded yet, you can upload it from this page. Point to the area at the right of the list to display a Plus icon.

    Upload Script File page with the New button highlighted.

    Click the Plus icon to display a popup window that allows you to select and upload your .js script file from your local environment. Fill in the required fields to select your file and then click Save.

    File page
  3. After you have selected the file, click Create Script Record.

    Upload Script File page with the Create Script Record button highlighted.

    The system displays the Script page, with your .js script file listed on the Scripts subtab. Fields that are automatically filled in based on your script (API Version, Script File, Type, and Functions) are read-only and cannot be changed. Remember, these fields are automatically filled in based on the content of your script file.

    Script page with the Name field highlighted.
    Note:

    If the system redirects you to a page that prompts you to select a script type, that means that in Step 2 you identified a SuiteScript 1.0 file. You can click the Back button in your browser to return to the previous page and select a different file. If the script you want to use is a 1.0 version script, you should convert it to SuiteScript 2.0.

  4. Enter a name in the Name field.

  5. In the ID field, optionally enter a custom ID for the script record. If the ID field is left blank, a system-generated internal ID is created for you when you save the record.

  6. If the Portlet Type field is displayed, select the appropriate value. This field is available only for the portlet script type, and it is a required field.

  7. In the Description field, optionally enter a description for the script.

  8. If appropriate, change the value of the Owner field. By default, this field is set to the currently logged-in user.

    Note that after the script record is saved, only the owner or a system administrator can modify the script record.

  9. If appropriate, check the Inactive box. Marking a script record as inactive prevents the script from executing. When a script is set to Inactive, any deployments associated with the script are also inactive.

  10. The Scripts subtab shows your script file name. You can select a different script file using icons next to the Script File field.

  11. On the Parameters subtab, define any parameters (custom fields) that are used by functions in the script. For information about script parameters, see Working With Script Parameters.

  12. On the Unhandled Errors subtab, optionally define the people to be notified if any script errors occur.

    Three types of error notifications are sent:

    • An initial email is sent on the first occurrence of an error within an hour.

    • A second email with aggregated error information for every hour is sent. (The error counter is reset when this email is sent.)

    • A third email is sent for the first 100 errors that have occurred after the error counter is set to 0.

    For example, if an error is thrown 130 times within an hour, an initial email is sent. Then, after the 100th occurrence, another email is sent. Since there are an additional 30 occurrences within the same hour, a final summary email is sent at the end of the hour. During the second hour, if there are only 50 occurrences of the error, only one summary email is sent at the end of that hour.

    By default, the Notify Script Owner box is checked. You can also identify other people to receive notifications, as follows:

    • Check the Notify All Admins box, if all administrators should be notified.

    • Select one or more groups from the Groups list. To define new groups, go to Lists > Relationships > Groups > New.

    • Enter the email addresses of any other users who should be notified. You can enter a comma-separated list of email addresses.

  13. Optionally, define a deployment for the script record by clicking the Deployments subtab and adding a line to the sublist. For more information about adding a line to this list, see Deploying a Script by using the Deployments Sublist. You can also add a script deployment without adding a deployment to this list and clicking Save and Deploy when you are ready to save your script. This will display the Script Deployment page where you will define your deployment.

  14. If this is a client script, optionally add lines to the Buttons sublist, which appears on the Scripts subtab. You can translate the labels for these buttons. This feature is available in accounts with multi-language feature only.

  15. If the Scripts subtab includes the Custom Plug-in Types sublist, optionally add lines to this list.

  16. To save the new record, click one of the following:

    • Save – to save and close the record.

    • Save and Deploy – to save the script record and open the Script Deployment page that lets you create a new script deployment record.

When you save the script record using Save, the system shows the new script record on the Script page in view mode. The Scripts subtab lists all possible entry point functions that could exist for the script type used in your script. The entry points used in your script are checked. For example:

Script page with the Scripts list showing entry point functions for a user event script.

The entry point functions listed on the Scripts subtab cannot be edited. To add or remove an entry point function, you will need to edit the script and add or remove the appropriate entry point functions. When you save your changes, the script record’s list of entry point functions is updated to match the contents of the script file.

Related Topics

Script Record Creation
Working With Script Parameters

General Notices