User Reference field to List members from multiple groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2020 01:27 PM
We have a user reference field and need to be able to list the members from a select list of user groups. Is there a preferred method for doing this? We don;t need to know the group the user was selected from and the user may appear in more than one group. Any help is greatly appreciated.
Thanks
Ken
- Labels:
-
Project Portfolio Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2020 01:33 PM
Hi Ken!
You would need to implement a Reference Qualifier to specify the users associated with specific groups.
Once this is done, only those users will be available to choose from in your reference field.
This documentation should help you get this set up:
Hope that helps!
If it did, please mark as Helpful and consider setting this reply as the Correct Answer to the question, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2020 01:37 PM
Hi,
You should query the table sys_user_grmember and then create an array with the user that you are looking for and apply it on the ref_qual of the field. It should something like this:
// this on the ref qualifier of the fields
javascript: new scriptInclude().function(current.group);
// the code inside script Include function
var arrUsers = [];
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', current.group);
grMember.query();
while(grMember.next()) {
arrUsers.push(grMember.user);
}
return 'sysIdIN' + arraUSers.join();
You can customize the qualifier as you wish with the query in the GR.
If it was helpful, please give some positive feedback.
Thanks,
☆ Community Rising Star 22, 23 & 24 ☆
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2020 06:53 AM
Mark and Adrian
Thank you for the helpful posts. I need to be able to include sys_user_grmember records from multiple groups. Can I just add querys for each group? Is there a best practice to keep good performance.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2020 07:37 AM
Hi,
If you need to query multiple groups you can add an encodedQuery with the sys_id of the groups that you need, this Ids should be declared as a system_property.
If it was helpful, please give positive feedback.
Thanks,
☆ Community Rising Star 22, 23 & 24 ☆