--- title: Catalog client scripts description: Client-side scripts can add dynamic effects and validation to forms. Scripts can apply to service catalog items or variable sets, allowing administrators to use the same functionality that is available on other forms.When you create catalog client scripts, be aware of the following considerations.Catalog client scripts are very similar to standard client scripts, with a few important differences.Follow this procedure to create a catalog client script.Examples of client scripts to perform common actions. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/scripts/c\_CatalogClientScriptCreation.html release: australia product: Scripts classification: scripts topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 4 breadcrumb: [Client-side scripting, Scripting, API implementation, API implementation and reference] --- # Catalog client scripts Client-side scripts can add dynamic effects and validation to forms. Scripts can apply to service catalog items or variable sets, allowing administrators to use the same functionality that is available on other forms. You can use client side scripts to: - Get or set variable values. - Hide or display variables. - Make variables mandatory or not. - Validate form submission. - Add something to the cart. - Order something immediately. **Parent Topic:**[Client-side scripting](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/client-side-scripting-overview.md) ## Catalog client script considerations When you create catalog client scripts, be aware of the following considerations. - Catalog client scripts run when a user orders an item from the service catalog. Catalog client scripts can also run when variables or variable sets for a catalog item are displayed when a user requests that item. - For a variable to be accessible using a catalog client script, it must have a variable name. Variables without names do not appear in the list of available variables. - When using standard client scripts on a Requested Item or Catalog Task form, make a note of fields with the same name as variables. If a table field and a variable of the same name are both present on a form, the table field is matched when it is accessed using a script. If this happens, specifically address the variable by naming it `variables.variable name`. For example: `g_form.setValue('variables.replacement', 'false');` - If you are using record producers to pass variables from the service catalog to other types of records, these variables are made visible in those records with a variable editor, such as the Change Variable Editor UI formatter on Change request forms. You can manipulate these variables using standard client script methods, such as `setDisplay`, `setMandatory`,`setValue`, and `getValue`. - Catalog client scripts can be used for catalog items included in a wizard. - You can use the `g_form.refreshSlushbucket(fieldName)` API to update a list collector variable. ## Catalog client script differences Catalog client scripts are very similar to standard client scripts, with a few important differences. - Instead of selecting a table such as Incident for the script, select a catalog item or variable set. As your system may have a large number of catalog items, you should select a catalog item or variable set using a reference field instead of the choice list that the standard Client Script form uses. - When using an *onChange\(\)* catalog client script, it is linked to a particular variable instead of a field. The system automatically populates the variable name selection list with any named variables from the catalog item or variable set selected. ## Create a catalog client script Follow this procedure to create a catalog client script. ### Before you begin Role required: admin ### Procedure 1. Navigate to **All** > **Service Catalog** > **Catalog Administration** > **Catalog Client Scripts**. A list of current custom catalog client scripts appears. 2. Click **New**. 3. Fill in the fields, as appropriate \(see table\).
| Field | Description |
|---|---|
| Name | Enter a unique name for the catalog client script. |
| Applies to | Select the item type this client script applies to:- **A Catalog Item**: enables the Catalog item field. - **A Variable Set**: enables the Variable set field. |
| Active | Select the check box to enable the client script. Clear the check box to disable the script. |
| UI Type | Whether to apply this to desktop, mobile, or both.- Desktop: The script runs only in the desktop Core UI. - Mobile / Service Portal: The script runs only in mobile, portal, or configurable workspace UIs. - All: The script executes across all available UIs. |
| Script | Enter the client script that should run on the service catalog item. |
| Type | Select when the script should run, such as **onLoad** or **onSubmit**. |
| Catalog item or Variable set | Select a catalog item or variable set from the list. The field name and options available depend on the selection in the **Applies to** field. |
| Applies on a Catalog Item view | Select the check box to apply the catalog client script to catalog items displayed within the order screen on the service catalog. Available in the requester view. |
| Applies on Requested Items | Select the check box to apply the catalog client script on a Requested Item form, after the item is requested. Available in the fulfiller view. See [VEditor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/service-catalog-variable-editor.md) . |
| Applies on Catalog Tasks | Select the check box to apply the catalog client script when a Catalog Task form for the item is being displayed. Available in the fulfiller view. See [VEditor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/service-catalog-variable-editor.md) . |
| Applies on the Target Record | Select the check box to support the catalog UI policy on a record created for task-extended tables via record producers. See [Default variable editor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/service-catalog-variable-editor.md) . |