The CreatorCon Call for Content is officially open! Get started here.

Suzanne Smith
ServiceNow Employee
ServiceNow Employee

Your service catalog is an important path for interacting with your users. When creating your service catalog, you can incorporate variables. A service catalog variable records and passes on information about user choices when users order catalog items. For example, you can define a variable to affect the price of an item. When a user orders a new laptop, the laptop catalog item can have a variable named Hard Drive Size so the user can specify the hard drive size they want, with larger sizes having an additional cost. Sometimes, though, you may run into pesky issues when working with variables that can leave you scratching your head. There are a few actions you can take when a variable doesn't show up on your form or when you need to troubleshoot your catalog variables.

4 Gotchas to look out for when working with Service Catalog Variables

  • Checking that the variable editor is on the form
  • Checking that the variable settings are configured correctly
  • Confirming that the variable is defined on the workflow or execution plan
  • Checking that the variable is not associated twice

We have seen a number of questions about Service Catalog variables pop up in the community. Here's a handy summary of common issues, some troubleshooting tips, and links to more detailed information.

Check that the Variable Editor is on the form

After an item is ordered, variables information is sent to a different record (the target record), most often sc_req_item. If there are no variables on a form or the variables are not visible, ensure that theVariable Editor field is added to the target record form.

service_catalog_variables1.png

If you do not see the Variable Editor option on the list, you may have misconfigured UI Formatter records in your instance. Navigate to System UI > Formatters and check that the following records have Active = true and that they have not been modified:

  • Change Variable Editor
  • Incident Variable Editor
  • Variable Editor (Requested Item)
  • Variable Editor (Catalog Task)

Note that the variable editor is only available for Change, Incident, Requested Item and Catalog Task. You can set the Variable Editor to appear on task-extended tables by creating your own formatter.

Another possible reason you may not see variables on a form is that you are using the wrong view. Try changing to Default View.

One last troubleshooting step is to ensure that you do not have any conflicting client scripts or UI policies. This annoying problem can appear if you have a variable on the item that has the same name as a field on the form.   If a client script or UI policy is set to take action on the field, it might take action on the variable instead.

For more information, see Determining if the Variable Editor is added to the form.

Ensure that variable settings are configured correctly

Variables can be configured in several places. A good, central spot to start your troubleshooting from is the Variables related list on a form. Following is an example using the form for a catalog item.

  1. Navigate to Service Catalog > Catalog Definitions > Maintain Items.
  2. Open an item record.
  3. View the Variables related list section or tab.
  4. Open a variable.
  5. Try these troubleshooting tips:
    • Is the Mandatory option selected? Making a variable mandatory can clash with an existing client script or UI policy.
    • Has a Default value been set for the variable? Because scripting can be used, a default value can be intricately created, but confusing for end users. Double-check any default value that has be set to determine if it is necessary and if it is clashing with other settings.
    • Is the Active option selected? The variable needs to be active to behave correctly.
    • Is the Read roles option configured? (This option does not appear on the form by default, but may have been added manually.) If a restricted read role is set, the variable may not appear.
  6. If you made changes you want to save, click Update.

For more information, see Determining if variable settings are incorrectly configured.

Confirm that the variable is defined on the workflow or execution plan

If you are seeing symptoms such as missing variables, duplicate variables, mandatory value not behaving correctly, or read-only status not behaving correctly, the problem could be with variables not defined on the workflow.

For example, a customer contacted us because the Variable Editor on the Catalog Task form was not successfully carrying over all the variables that were created on all items. Also, it was not displaying those variables on the Catalog Task form. The problem was that, you guessed it, the catalog task workflow activity did not include the variables that were on the catalog item. The variables had be added to the correct workflow activity on the appropriate workflow. You can do this by opening the workflow, identifying the activity creating the task, and then moving the correct variables from the Available list on the left to the Selected list on the right.

service_catalog_variables2.png

For more information, see Determining if a variable is defined on the workflow or execution plan.

Is the variable associated twice?

This is a specific issue that can be maddening to troubleshoot. If a variable is associated twice (once as an individual variable and once as a member of a variable set) with the same item, you can see symptoms such as the variable losing value, data not transferring correctly, and client scripts and UI policies working incorrectly.

To test for this problem, open an item record. Personalize the layout by adding the Variable set list. Check for any variables that appear in the Variables related list and the Variables Sets related list. In the example below, the variable named Brand is added individually in the Variables related list and is also a member of the added Variable set named hardware_order.

service_catalog_variables3.png

You can resolve this issue by doing one of the following:

  • remove the variable from the Variables related list
  • remove the variable set containing the variable from the Variable Sets related list
  • remove the variable from the variable set (be careful using this option if the variable set is used by more than one item!)

For more information, see Determining if a variable is associated twice.

Additional information

There are many lively discussions in the Community about Service Catalog variables:

General information about Service Catalog variables in the product documentation:

2 Comments