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.

How to get particular user group members into Catalog variable ?

ragz
Tera Expert

I have a user group called On call support . Group contains 9 users .

How to get those users into service catalog variable .

It could be a select box , reference variable or any better one . Just need to select one user from the 9 users and assign.

1 ACCEPTED SOLUTION

Jay_Ford
Kilo Guru

Use a lookup select box...

 

find_real_file.png

 

 

find_real_file.png

View solution in original post

4 REPLIES 4

Jay_Ford
Kilo Guru

Use a lookup select box...

 

find_real_file.png

 

 

find_real_file.png

sravan273
Kilo Contributor

Create a reference variable --> Type Specification section

1) reference field -->select  sys_user_grmember

2) reference qualifier condition --> Give your group name --> On call support 

find_real_file.png

Lukasz Bojara
Kilo Sage

Hi,

You should create a Variable of type Lookup Select Box. Set it to point to sys_user_grmember table, the value should be set to User, mark the Unique values and add reference qualifier to filter the group.

 

E.g. get only users from Network group:

find_real_file.png

The result is this:

find_real_file.png

 

Hope this helped.

 

Best regards,
Łukasz

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So user group is a reference variable on catalog

then create a reference variable to sys_user table and have reference qualifier on 2nd variable to only show members of the above group

put the below line in reference qualifier

javascript: getUsers();

script include code

function getUsers(){

var arr = [];

var gr = new GlideRecord('sys_user_grmember');

gr.addQuery('group', current.variables.groupVariable); // put your group variable name here

gr.query();

while(gr.next()){

arr.push(gr.getValue('user'));

}

return 'sys_idIN' + arr.join(',');

}

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