Reference field referring to user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:24 PM
Hi,
I have a reference field named "TRO" on the incident which refers to the user table & we have to show users who are part of the "ABC" group. Can someone please help me out on this?
Regards,
Chirag Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:39 PM
2 ways
1) have role assigned to that group and then assign advanced ref qualifier with roles=roleABC
OR
2) have advanced ref qualifier and call script include and get group members of that group
what did you start with and where are you stuck? this is an easy task
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:55 PM
Create a script include:
var ABCGroupUsers = Class.create();
ABCGroupUsers.prototype = {
initialize: function() {
},
getABCGroupUsers: function() {
var users = [];
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group.name', 'ABC');
grMember.query();
while (grMember.next()) {
users.push(grMember.user.sys_id.toString());
}
return users.join(',');
},
type: 'ABCGroupUsers'
};
And set the reference qualifier on the field to this:
javascript: 'new ABCGroupUsers().getABCGroupUsers()'
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark