- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2025 10:42 PM
Afternoon everyone.
Looking for a bit of help - I'm creating a new catalog item. We have a mandate that will only let our 'regular users' (i.e., not IT staff) managers have to request access for their staff for certain items, which I've achieved by putting on a reference qualifier on the requested_for variable (manager is (dynamic) me, or manager_manager is (dynamic) me) .
I need to be able to override this for my Service Desk team to be able to raise requests for anyone in the Business.
Is it possible to make the reference qualifier conditional at all?
Many thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2025 12:50 AM
you can use advanced ref qualifier as this
-> if logged in user doesn't have itil role then it applies the reference qualifier and restricts the users
-> if logged in user has itil role then no query it means it will show all active users
javascript: var query = '';
if (!gs.hasRole('itil'))
query = 'manager=' + gs.getUserID() + '^ORmanager.manager=' + gs.getUserID();
query;
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2025 07:27 PM
there is a typo in your ref qualifier, please correct that and it should work
colon : is replaced with :
This is known issue when we post in community and it converts that character automatically
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2025 08:48 PM
I thought it looked odd!!
Ankur, that has worked a treat. Thank you so much!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2025 11:19 PM
Hi @JonnyFoster ,
Yes, you can add multiple conditions to the reference qualifier. Use Advanced reference qualifier to build your conditions.
A sample code:
javascript:
var query;
var groupName = current.variables.<variable_name>;
var membershipUtils = new global.<your_script_include>();
if (current.variables.<variable_name> == "<condition>") {
query = 'active=true^sys_idNOT IN' + membershipUtils.<method_name>(<parameters>);
} else if (current.variables.<variable_name> == "<Condition>") {
query = 'active=true^sys_idIN' + membershipUtils.<method_name>(<parameters>);
} else {
query = 'active=true';
}
query;.
.
Refer these links:
Reference Qualifiers in ServiceNow - ServiceNow Community
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2025 11:59 PM
Hi you can try this script:
Navigate to your catalog item, edit the requested_for variable,
and in the reference qualifier field enter:
javascript:(function() {
if (gs.hasRole('itil')) {
return 'active=true';
} else {
var managerId = gs.getUserID();
var userList = managerId;
var gr = new GlideRecord('sys_user');
gr.addQuery('manager', managerId);
gr.query();
while (gr.next()) {
userList += ',' + gr.sys_id;
}
var gr2 = new GlideRecord('sys_user');
gr2.addQuery('manager.manager', managerId);
gr2.query();
while (gr2.next()) {
userList += ',' + gr2.sys_id;
}
return 'active=true^sys_idIN' + userList;
}
})()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2025 11:29 PM
No dice on this one, Max, I'm afraid. Nothing changed, apart from all users were available whether a role is applied or not.
Thanks for your help, though...
