How to provide Group Members in Record Producer Reference field of User for particular group ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
56m ago
How to provide Group Members in Record Producer Reference field calling User form for particular group in Scoped Application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
50m ago - last edited 49m ago
@VIKASM535239375 I would recommend using a Script Include for the reference qualifier instead of writing the complete logic directly in the Record Producer.
Create a Script Include to get the users from sys_user_grmember, and then call that Script Include from the Advanced Reference Qualifier of the User reference field.
Reference Qualifier:
javascript:new GroupMembers().getMembers('GROUP_SYS_ID')
This will keep the Record Producer configuration simple and make the logic reusable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a minute ago
Hello @VIKASM535239375 ,
You can add advanced reference qualifier in your variable section :
Then from script include filter out the users for particular group :
var GroupMemberUtils = Class.create();
GroupMemberUtils.prototype = {
initialize: function() {},
getGroupMember : function() {
var groupSysId = '<your_group_sys_id>'; // or fetch dynamically
var userIds = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupSysId);
gr.query();
while (gr.next()) {
userIds.push(gr.getValue('user'));
}
return 'sys_idIN' + userIds.join(',');
},
type: 'GroupMemberUtils'
};
If have to pass group dynamically :
javascript:new GroupMemberUtils().getGroupMember(current.variables.group_field);
If my response helped mark as helpful and accept the solution.
