Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get the Users of specific Group

Rakshanda Kunte
Tera Contributor

Hi All,

 

I have 2 field Members (List Collector) and Group Name (Reference) in a catalog item.

 

Whenever a requester selects a group so in the Member field the list of users in who is part of that group should populate as options to select. 

 

RakshandaKunte_0-1698839403487.png

 

 

Kindly, help with the scripting.

 

Thank you..!!

1 ACCEPTED SOLUTION

@Rakshanda Kunte 

something like this in advanced ref qualifier

javascript: var query;
var arr = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", current.variables.group_name);
gr.query();
while (gr.next()) {
   arr.push(gr.getValue('user'));
}
query = 'sys_idIN' + arr.toString();
query;

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

View solution in original post

7 REPLIES 7

@Vishal Birajdar 

Should script Include client callable or no?

Hi @Rakshanda Kunte 

 

No, it should not as we are calling it from reference qualifier...!!!

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

@Rakshanda Kunte 

no script include required.

Did you check my above response? It will work fine for you

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