top of page

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,080 per month

Using Reference Qualifiers with Lookup Select Box Variables in ServiceNow




In ServiceNow, reference qualifiers are used to filter the data returned for a reference field. When applied to Lookup Select Box variables in the Service Catalog, they allow dynamic filtering of options based on user input, enhancing the user experience by showing only relevant choices. This feature is especially useful in forms with dependent fields, where the value selected in one variable affects the options in another.


However, developers often face challenges configuring reference qualifiers for Lookup Select Box variables. Issues such as filters not updating dynamically, empty drop-down lists, or script errors are common. This article provides a step-by-step guide on correctly setting up reference qualifiers in Lookup Select Box variables, explaining the use of the ref_qual_elements attribute, troubleshooting tips, and alternative approaches.


Configuring Reference Qualifiers for Lookup Select Box Variables


Step-by-Step Setup

  1. Create a Lookup Select Box Variable

    • In a catalog item or record producer, add a variable.

    • Set the type to Lookup Select Box.

    • Specify the table to query.

    • Set value and label fields.


  2. Define the Reference Qualifier

    • Use a simple query (e.g., active=true) for static filtering.

    • Use advanced JavaScript for dynamic filtering:

      javascript:"assigned_to=" + current.variables.requested_for


  3. Add the ref_qual_elements Attribute

    • In the variable's Attributes field, specify the dependent variable:

      ref_qual_elements=requested_for

    • This ensures the Lookup Select Box updates when the dependent variable changes.


  4. Test the Form

    • Select values in the controlling variable and verify the lookup list updates accordingly.


Example Use Case


Imagine a catalog item with two variables:

  • requested_for (reference to sys_user)

  • user_assets (Lookup Select Box referencing alm_asset)

To filter user_assets by the selected requested_for, configure as follows:

  • Reference qualifier:

    javascript:"assigned_to=" + current.variables.requested_for

  • Attributes:

    ref_qual_elements=requested_for


Troubleshooting Common Issues


  • Lookup List Not Updating:

    • Ensure ref_qual_elements is set correctly.

    • Check for typos in variable names.

  • Empty Options List:

    • Validate the filter query returns records.

    • Confirm the dependent variable has a value.

  • Script Errors:

    • Use current.variables.variable_name syntax.

    • Test GlideRecord queries separately for accuracy.

  • Portal-Specific Issues:

    • Clear cache and test in both classic UI and Service Portal.

    • Use Catalog Client Scripts and GlideAjax as a fallback.


Alternative Approach: Using GlideAjax


If standard qualifiers don't work, use GlideAjax and Catalog Client Scripts:

  1. Create a Script Include that returns filtered results.

  2. Call the Script Include using GlideAjax in a client script.

  3. Populate the Lookup Select Box with g_form.addOption().

This method offers flexibility for complex logic or older versions where ref_qual_elements may not function reliably.


Conclusion


Reference qualifiers, when combined with the ref_qual_elements attribute, are a powerful way to create dynamic, user-friendly forms in the ServiceNow Service Catalog. They allow Lookup Select Box variables to respond intelligently to user input, ensuring only relevant data is displayed.


For best results:

  • Always use ref_qual_elements when dependencies exist.

  • Test filters in both classic UI and Service Portal.

  • Consider GlideAjax only for complex or unsupported scenarios.


Mastering reference qualifiers will significantly enhance your ServiceNow development capabilities, leading to more intuitive and efficient user experiences.

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,080 per month

CONTACT

New Zealand HQ

Integrated Knowledge Consulting Office

Level 3, 93 Grafton Road

Auckland

South Korea

Integrated Knowledge Consulting Office

BMY역삼타워 6층

서울특별시 강남구 역삼동 678-10번지

 

info@ikconsulting.com

Thanks for submitting!

  • LinkedIn Social Icon

© Copyright 2025 Integrated Knowledge Consulting. All rights reserved.

bottom of page