Reference qualifier to show specific user group

nealp_
Tera Contributor

I have a field on the form "Executives" and I want to use reference qualifier to show a specific group 'exec_group'. I can reference the 'user' in the reference but how do I filter through to show just the user group with select few users?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

You need advanced reference qualifier for this. Create a script include and put this script in there


function   GetExecutiveMembers(){


  var id=[];


  var gr= new GlideRecord('sys_user_grmember');


  gr.addQuery("group.name","your group name");


  gr.query();


  while(gr.next()){


  id.push(gr.getValue("user"));


  }


  return "sys_idIN"+id.join();


}


View solution in original post

10 REPLIES 10

Swapnil Bhakar1
Mega Guru

Hi Neal,



Are you created two different fields to show group and group members for this?


If you are using different fields to show group and group members then you need to make your second field dependent it means where you are showing group members in a group.


Same like assignment group and assigned to field which are present OOB.



Refer below thread hope it will help you.


Reference Qualifiers - ServiceNow Wiki  



Regards,


Swapnil



PS: Hit like, Helpful or Correct depending on the impact of the response


No, just one field that says 'executives' and I want that to reference user group 'exec_group' (executives group)


Hi Neal,



If you are using one field to show only those users which are present in 'exec_group' then follow below steps to fulfill your req.



1. First create your custom role(For e.g. Exec Role).


2. Assign your custom (Exec Role) created role to 'exec_group'.


3. In Executives field reference qualifier add below condition:



Ref qualifier: Roles is Exec Role(your custom created role)



Hope it will help you.



Regards,


Swapnil



PS: Hit like, Helpful or Correct depending on the impact of the response


Abhinay Erra
Giga Sage

You need advanced reference qualifier for this. Create a script include and put this script in there


function   GetExecutiveMembers(){


  var id=[];


  var gr= new GlideRecord('sys_user_grmember');


  gr.addQuery("group.name","your group name");


  gr.query();


  while(gr.next()){


  id.push(gr.getValue("user"));


  }


  return "sys_idIN"+id.join();


}