
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 07:21 PM
Hello!
I am building a Catalog Item where I need the requestor to select the user who will be working on their request (defining the assigned_to out of the Record Producer itself) out of the assignment group that triages all of these requests; the issue I am running into is that I am not able to create a specific filter/reference qualifier that would accomplish this (i.e. only show users within the specific assignment group).
The sys_id of the group itself is: '290177c8fb4cae50bb47e5374eefdc3e' --> if someone could help me figure this out (I believe I need a Script Include and then a reference qualifier on the variable itself?) I will quickly award a "solved" reply.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:07 PM
I believe that variable is referring to sys_user.
so use this in advanced reference qualifier so that it shows members of only that group
javascript:
var user = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", "290177c8fb4cae50bb47e5374eefdc3e");
gr.query();
while (gr.next()) {
user.push(gr.getValue('user'));
}
var query = 'sys_idIN' + user.toString();
query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:39 PM - edited 03-02-2025 08:39 PM
Hi @Nick Derbawka,
In the advanced reference qualifier you can write the script or You can also use the Script include. As advanced reference qualifier approach script is already posted.
For the script include approach here is the script:
//In advanced reference qualifier add this
javascript: new application_scope.script_IncludeName().functionName('sys_id_of_group');
//Here is Script Include function
functionName : function(grpId){
var grpUsers = [];
var grpM = new GlideRecord("sys_user_grmember");
grpM.addQuery("group",grpId);
grpM.query();
while(grpM.next())
{
grpUsers.push(grpM.user.toString());
}
var userList = 'sys_idIN' + grpUsers.toString();
return userList;
},
Thanks & Regards,
Omkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:05 PM
Hello @Nick Derbawka,
Try this code,
var GetUsersByAssignmentGroup = Class.create();
GetUsersByAssignmentGroup.prototype = {
initialize: function() {},
getUsers: function() {
var users = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', '290177c8fb4cae50bb47e5374eefdc3e'); // Assignment group sys_id
gr.query();
while (gr.next()) {
users.push(gr.user.toString());
}
return users;
},
type: 'GetUsersByAssignmentGroup'
};
Mark as helpful if you got answer for your question.
Best Regards,
Rohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:07 PM
I believe that variable is referring to sys_user.
so use this in advanced reference qualifier so that it shows members of only that group
javascript:
var user = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", "290177c8fb4cae50bb47e5374eefdc3e");
gr.query();
while (gr.next()) {
user.push(gr.getValue('user'));
}
var query = 'sys_idIN' + user.toString();
query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 06:10 AM
Thank you for marking my response as helpful.
I also shared a working solution.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:39 PM - edited 03-02-2025 08:39 PM
Hi @Nick Derbawka,
In the advanced reference qualifier you can write the script or You can also use the Script include. As advanced reference qualifier approach script is already posted.
For the script include approach here is the script:
//In advanced reference qualifier add this
javascript: new application_scope.script_IncludeName().functionName('sys_id_of_group');
//Here is Script Include function
functionName : function(grpId){
var grpUsers = [];
var grpM = new GlideRecord("sys_user_grmember");
grpM.addQuery("group",grpId);
grpM.query();
while(grpM.next())
{
grpUsers.push(grpM.user.toString());
}
var userList = 'sys_idIN' + grpUsers.toString();
return userList;
},
Thanks & Regards,
Omkar