Client script form

Field descriptions for the client script form.

To open the client script form, navigate to System Definition > Client Scripts.

You can add client scripts only on tables that are in the same scope as the client script (starting with the Fuji release).

Figure 1. Client script form
The client script form provides the following fields:
Table 1. Client script form
Field Description
Name Unique, descriptive name for this script.
Application Application that contains this client script (starting with the Fuji release).
Active Indicator of whether the script is active.
Global Indicator of whether the script applies to all views. When Global is selected, the script runs regardless of what view is being displayed. When Global is not selected, this script runs only if the current view matches the script's view.
View View to which the script applies. This option is available only if Global is not selected.
Type Indicator of when the script runs. Select one of the following types:
  • onLoad(): when a form is first loaded.
  • onSubmit(): when a form is submitted. This type allows you to cancel the submission, if necessary.
  • onChange(): when a specified field on the form changes value.
  • onCellEdit(): when a user interacts with a specified field in a list.
Table Table or database view to which this script applies, such as incident or change_request.
Note: The list shows only tables and database views that are in the same scope as the client script (starting with the Fuji release).
Inherited Indicator of whether this script applies to any extended tables. For example, if the script is active on the task table, selecting Inherited runs this script on the incident, change_request, and problem tables, as well.
Field name Field to which the script applies. This option is available only if Type is set to onChange().
Description Detailed description of the client script.
Messages Text strings available to the client script. Enter one string per line using getMessage(msg) syntax. You can use these strings in the client script as localized messages without the need for an AJAX call, which allows for the internationalization of messages displayed in alerts, for example, without a round trip to the server. As an example, if the Message field has the line Please populate the Reason field, and an entry exists in the sys_ui_message table for their language with that key, then the client script could have the following line:
alert(getMessage(Please populate the Reason field));

and the user would see it in their language.

Script Script that executes when the client script is triggered.
UI Type Select the target UI this script applies to: Desktop, Mobile, or Both.
Related lists on the form view:
Versions All versions of the client script. Use this list to compare versions or to revert to a previous version.