---
sourceDocument: Brazil ServiceNow AI Platform Capabilities
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/servicenow-platform

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# Service Catalog client scripts

# Service Catalog client scripts {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read  
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.

{#c_CatalogClientScriptCreation__ul_fs2_2c1_dq}  
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 <var class="keyword varname">onChange()</var> 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.
{#c_CatalogClientScriptCreation__ul_dvh_llb_jbb}

## Considerations for using catalog client scripts {#c_CatalogClientScriptCreation__section_fvg_yrf_mjc}

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.
{#c_CatalogClientScriptCreation__ul_hrg_zrf_mjc}

## Create a Service Catalog client script {#ariaid-title2}

You can create client scripts to customize the catalog.

### Before you begin

Role required: admin

### About this task

Use catalog client scripts to control the behavior of the catalog items
when presented to your users. Catalog client scripts can be applied to a catalog
item or a variable set. These scripts run on the browser instead of the server,
allowing you to better control the information that the user submits.  
The priority order for g_form APIs is:

1. Mandatory (highest)
2. ReadOnly/Display
{#t_CreateACatalogClientScript__ol_lvz_g3z_sbb}

If a variable is set to mandatory and doesn't have a value, readonly or hide doesn't work on that variable. If a variable is hidden or readonly, and then set to mandatory, the variable field becomes visible or editable.

This priority order is also applicable for variable sets and containers. If a variable set or container has a mandatory variable without any value, then the container or variable set can't be hidden.

### Procedure

1. Navigate to AllService CatalogCatalog AdministrationCatalog Client Scripts.  
   A list of current custom catalog client scripts appears.
2. Select New.
3. On the form, fill in the fields.  
   {#t_CreateACatalogClientScript__table_bw1_3g1_dq__entry__2}

   | Field | Description |
   |-|-|
   | Name | Unique name for the catalog client script. |
   | Applies to | Item type this client script applies to: * A Catalog Item: enables the Catalog item field. * A Variable Set: enables the Variable set field. {#t_CreateACatalogClientScript__ul_nx1_3g1_dq} |
   | Active | Check box to enable the client script. Clear the check box to disable the script. |
   | UI Type | Whether to apply this field to desktop, Classic Mobile, or both. |
   | Script | Enter the client script to run on the service catalog item. |
   | Type | Select when the script runs, 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 | 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 | 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://servicenow-prod.fluidtopics.net/zcx4HZKvPkTA8XqPso7MBg#service-catalog-variable-editor__cat-VEditor). |
   | Applies on Catalog Tasks | 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://servicenow-prod.fluidtopics.net/zcx4HZKvPkTA8XqPso7MBg#service-catalog-variable-editor__cat-VEditor). |
   | Applies on the Target Record | Check box to support the catalog client script on a record created for task-extended tables via record producers. See [Default variable editor](https://servicenow-prod.fluidtopics.net/zcx4HZKvPkTA8XqPso7MBg#service-catalog-variable-editor__cat-default-variable-editor). |
   [ ]

   {#t_CreateACatalogClientScript__table_bw1_3g1_dq}
4. Select Submit.

*[\>]: and then


