How to restrict a reference variable field(Users) to get only users specific groups in Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2019 04:28 AM
I have a requirement to display users of particular groups(multiple) in the reference field of service catalog. How can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2019 04:29 AM
Hi,
You need to use reference qualifier for this requirement.
https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/script/server_scripting/concept/c_AdvancedReferenceQualifierExample.html
https://docs.servicenow.com/bundle/london-platform-administration/page/script/server-scripting/task/t_ConfigureReferenceQualifiers.html
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2019 04:30 AM
You would build a reference qualifier. This should help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2019 09:00 PM
I have tried using the below script, but it seems to be not working.
javascript:var users='';
var groupname = ["eff6fed54f742300fd37045e9310c78e","f3a04f264ff72300fd37045e9310c7d5"];
var gr = new GlideRecord('sys_user_grmember');
groupname.forEach(function(element){
gr.addQuery('group','element');
gr.query();
while(gr.next()){users+=gr.user.sys_id + ",";}})
"sys_idIN" + users;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2019 09:10 PM
If you want to restrict only two groups no need to write client scripts, please go to the field and right click on it and select configure dictionary, there you have condition builder from that
use simple qualifier condition
you can select for example Assignment Group = Service Desk and Assignment Group = Cab Approval is enough