How to restrict service catalog variable to only one group and its members

Bruce11
Giga Expert

I have a variable referencing sys_user_group table however, i want ONLY group A to show in the field when searching the group table and ONLY the members of group A should show up when selecting a user. How can i best achieve this?

Thanks for your help.

1 ACCEPTED SOLUTION

So you're saying for the group field you only want Group A to show...then why aren't you setting the default value of that field to Group A?

In the variable settings for that field, set the default value to the sys_id of Group A, that way it's already selected.

To get the group sys_id...you can go to your group listing within your instance and right-click on the record/line item and copy the sys_id, like so:

find_real_file.png

Then for your reference field for the group members...do below:

You'd want to set the reference qualifier field on the group member field to be:

group=sys_id_of_group(same as you used above)

So in this group member field you now have to make, go to the reference qualifier section and set it with the above.

Example:

find_real_file.png

 Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hello,

Only groups will show up in that reference field, do you have another reference variables for the members to show?

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Yes. It appears i will need a second field for the group member (sys_user_grmember). How do i restrict to ONLY the members of the group? (please note the group field is restricted to only group "A"). Please provide steps if available.

So you're saying for the group field you only want Group A to show...then why aren't you setting the default value of that field to Group A?

In the variable settings for that field, set the default value to the sys_id of Group A, that way it's already selected.

To get the group sys_id...you can go to your group listing within your instance and right-click on the record/line item and copy the sys_id, like so:

find_real_file.png

Then for your reference field for the group members...do below:

You'd want to set the reference qualifier field on the group member field to be:

group=sys_id_of_group(same as you used above)

So in this group member field you now have to make, go to the reference qualifier section and set it with the above.

Example:

find_real_file.png

 Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Allen, thank you so much. This looks like what i need. The reference qual with the group sys_id was pulling up the sys_id of the members and not their names. 

I found the below on community and it worked 

javascript:var gr = new GlideRecord('sys_user_grmember');gr.addQuery('group',"<insert your group's sys_id>");gr.query();var users='';while(gr.next()){users+=gr.user.sys_id + ",";}"sys_idIN" + users;