Reference field should populate members of a group. I have a reference field "Name" which is refer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 07:58 AM
Reference field should populate members of a group.
I have a reference field "Name" which is referenced to sys_user table. Right now I have all users being populated, but I want users which are a part of 10 group members only to be included in this.
I know it requires a script include and javacript on the reference qualifier. Could someone help me with the script include and how to call is on the advanced reference qualifier.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 08:08 AM
@Archana23 Here is the script include code.
var UserGroupFilter = Class.create();
UserGroupFilter.prototype = {
initialize: function() {},
getFilteredUsers: function() {
var allowedGroups = [
'GROUP_SYS_ID_1',
'GROUP_SYS_ID_2',
'GROUP_SYS_ID_3',
'GROUP_SYS_ID_4',
'GROUP_SYS_ID_5',
'GROUP_SYS_ID_6',
'GROUP_SYS_ID_7',
'GROUP_SYS_ID_8',
'GROUP_SYS_ID_9',
'GROUP_SYS_ID_10'
];
//Replace the GROUP_SYS_ID_1....../GROUP_SYS_ID_ with the actual sys_ids of the groups
var users = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('groupIN' + allowedGroups.join(','));
gr.query();
while (gr.next()) {
users.push(gr.user.toString());
}
return 'sys_idIN'+users.join(',');
},
type: 'UserGroupFilter'
};
Reference qualifier:
javascript: new UserGroupFilter().getFilteredUsers();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 05:53 AM
Hi @Sandeep Rajput ,
Please help me with system property to store groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 06:50 AM
Put gs.getProperty('Property name');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 06:54 AM
Please help me in calling that in script include and complete script