- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-16-2023 11:53 PM
Reference qualifiers in ServiceNow are filters that restrict the data that appears in reference fields. They help refine the choices available in a reference field by defining conditions that the referenced records must meet.
Types of Reference Qualifiers:-
1. Simple Reference Qualifier:- A simple reference qualifier in ServiceNow is often written as an encoded query string or a GlideRecord query. It's used to filter the choices available in a reference field based on specific criteria. Here's an example of a simple reference qualifier: -
Suppose We are applying the Reference Qualifier on the Caller Field of the Incident Table.
Here we are using the Simple Reference Qualifier where the condition is When Location is India.
It will only show the User in the Caller Field whose Location is India.
2. Dynamic Reference Qualifier:- It dynamically changes references or qualifiers based on user input into the fields of the current form.
Here's an example of a dynamic reference qualifier: -
Use Reference Qualifier - Dynamic
Dynamic ref qual - Create New Dynamic Filter Options
In the Script:-
return "location=" + current.location;
Suppose we have a field on the Incident table called Location.
We want to show/filter the users in the caller field whose location is the same as the Value of Location in the Incident Form.
3. Advanced Reference Qualifier:- Advanced Reference Qualifiers" refer to a mechanism that allows you to dynamically filter and restrict the data that appears in reference fields on forms.
Here's an example of an Advanced reference qualifier: -
Use Reference Qualifier - Advanced
Reference qual:- javascript: new myScriptInclude.myNewFunction();
myScriptInclude // Script Include Name
myNewFunction() // Script Include Function Name
Scenario :-
We want the users to show/filter users in the caller field, who are in the Same department of the logged-in user.
var myScriptInclude = Class.create();
myScriptInclude.prototype = {
initialize: function() {},
myNewFunction: function() {
var gr = new GlideRecord('sys_user');
gr.get(gs.getUserID()); // It will find the record of Logged In user in User table.
var department = gr.getValue('department');
var users = new GlideRecord('sys_user');
gr.addQuery('department', department);
gr.query();
var refUsers = [];
while (gr.next()) {
refUsers.push(gr.getUniqueValue());
}
return 'sys_idIN' + refUsers;
},
type: 'myScriptInclude'
};
==========================================================================================================
If you find the article helpful, Please give me thumbs up on it 👍 😊.
Happy Learning 🙂
Regards,
Samaksh Wani (Community Rising Star 2023)
- 37,777 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Please check my article to improve performance of your reference qualifier. You can avoid unnecessary Glide Record queries and while loops.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Can Anyone help me, My Scenario is I'm having two Reference fields, 1. UPFs (this field is in main form) and 2.UPF NAME (this is in related list) and when the user selects the value in UPFs field then the same values should reflect in second field UPF NAME for selection. I'm trying through advance reference Qualifier but failing ..
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
You haven't said what you tried, but I'll give you and example of a reference qualifier that works for me.
This example creates a filter on server table for a custom field named u_application_instance and a catalog variable names application_instance. IT also filters for some values of the install status field.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
How do I filter the users based on the User Criteria table I created?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Samaksh Wani ,
I got a doubt here, in the script of advanced reference qualifiers. Why are we creating a users gliderecord object again? and if that is because gr object which was created before contains userID of the currently logged in user, then we should be using users in lines I highlighted instead of gr. Am I right? Correct me if I am wrong
TIA
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello folks!
I need help with a Dynamic Ref Qual field.
From the change_request table form:
1. My configuration item field (cmd_ci), needs to show the CIs related to the company previously selected,
1.1 This field is from the Task table
1.2 Field type "choice"
2. My Services field, needs to show the Terms and Conditions available for the company selected
2.1 Reference: clm_m2m_contract_and_terms
2.2 Field type: Reference