How to restrict a reference variable field(Users) to get only users specific groups in Service Catalog

Pravallika2
Kilo Contributor

I have a requirement to display users of particular groups(multiple) in the reference field of service catalog. How can I achieve this?

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Chuck Tomasi
Tera Patron

You would build a reference qualifier. This should help.

Reference qualifiers

Pravallika2
Kilo Contributor

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;

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