Catalog item reference field shows sysIDs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 12:05 AM
Hi All,
I would like to create a field that shows in the dropdown all the groups that the requester belongs to however
when I test this catalog item I see that the sysIDs of the groups are fetched instead of the names of the groups. How can I fix it?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2024 02:48 AM
Hm, can you maybe post a screenshot? Maybe it's just because I can't paste the query 1:1 here.
I tested it as shown in my screenshot above, and it worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 11:11 PM
Just checking: Did my hints help you, or is there anything left to get your solution up and running?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 11:30 PM
Hi @dev_K
Changing the display value of Group Member table is not the correct way.
You should not be referring your field to group member table, You have to refer to Group Table and write an advanced reference qualifier to call a script include which returns the group sys_id's.
Reference Qualifier:
javascript: new ScriptincludeName().functionName(current.requested_for);
Script Include function :
getMembers: function(user) {
var groups = [];
var grMember = new GlideRecord('sys_user_grmember');
grMember.addEncodedQuery('user=' + user);
grMember.addEncodedQuery('group.active=true')
grMember.query();
while (grMember.next()) {
groups.push(grMember.getValue('group'));
}
return 'sys_idIN' + groups.toString();
},
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP