Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Catalog client script examples

Catalog client script examples

Examples of client scripts to perform common actions.

Get the value of a variable

Use the following syntax to obtain the value of a catalog variable. Note that the variable must have a name. Replace variable_name with the name of the variable.

g_form.getValue('variable_name');

Restrict the number of characters a user can type in a variable

This is an example of a script that runs when the variable is displayed, rather than when the item is ordered.

functiononLoad()
          {var sd = g_form.getControl('short_description');
          sd.maxLength=80;
       }