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,000

How to Use Advanced Reference Qualifiers to Display Group Members in ServiceNow

Updated: Mar 29

Advanced Reference Qualifiers in ServiceNow enhance user experience by limiting choices in a reference field based on specific criteria. A common scenario involves restricting user selections to members of a particular group. This article provides clear, step-by-step instructions to set up reference qualifiers effectively.


Common Challenges When Setting Reference Qualifiers

When configuring reference fields in ServiceNow, a frequent requirement is to limit the displayed options to users belonging to a specific group. Users often encounter difficulties understanding how to implement this restriction, particularly whether they should use encoded queries or custom scripts.


Step-by-Step Guide to Implement Advanced Reference Qualifiers

Here’s how you can restrict a user reference field to display only members of a specific ServiceNow group:

Method 1: Using an Encoded Script (Recommended)

You can utilize an encoded JavaScript reference qualifier directly in the Reference field:

  1. Navigate to your Record Producer or form:

    • Locate your reference field pointing to the User table.

  2. Set the Reference Qualifier:

    • In the reference qualifier field, enter the following encoded JavaScript:

javascript:var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', "<INSERT_GROUP_SYS_ID>");
gr.query();
var users = '';
while(gr.next()){
    users += gr.user.sys_id + ",";
}
"sys_idIN" + users;

Replace <INSERT_GROUP_SYS_ID> with the actual sys_id of your target group.

This script dynamically fetches all user sys_ids associated with the specified group and restricts the reference choices accordingly.

Method 2: Using a Custom Script Include

Alternatively, you can create a reusable, client-callable Script Include for greater flexibility:

  1. Create the Script Include:

    • Navigate to System Definition > Script Includes, and create a new Script Include.

    • Set it to "Client callable."

var FilterUser = Class.create();
FilterUser.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    filter: function(groupID){
        var userList = '';
        var gr = new GlideRecord('sys_user_grmember');
        gr.addQuery('group', groupID);
        gr.query();
        while(gr.next()) {
            userList += gr.user + ',';
        }
        return 'sys_idIN' + userList;
    },
    type: 'FilterUser'
});
  1. Apply the Script Include in Reference Qualifier:

    • In the reference qualifier of your reference field, enter:

javascript:new FilterUser().filter('<INSERT_GROUP_SYS_ID>');

This method provides cleaner code management and reusability across multiple fields.


Alternative Solutions

While using a custom Script Include provides robustness and flexibility, the simpler encoded JavaScript method often suffices, especially for straightforward or one-time use cases.


Conclusion

Advanced Reference Qualifiers streamline user interactions by restricting reference field selections to specific criteria, such as group membership. Whether using a direct encoded query or a reusable Script Include, understanding these methods ensures efficient and effective ServiceNow configurations. Choose the method that best aligns with your scenario, ensuring clear and manageable reference qualifiers within your applications.

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,000

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