
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 08:30 PM
We are trying to add a reference qualifier for the field Additional Assignee List to limit the users shown on the lookup for users that are members of a certain group. We can see that there is a filter value for the role the user has but there is none for the groups he is part of.
UPDATE:
Thanks to everyone who provided feedback, especially to explorenow and harshvardhansingh.
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 03:49 AM
Hi explorenow thanks for this, we used this and modified a bit to fit on our exact requirement.
For other users with this similar requirement, just refer to the steps below:
Here's the final script we used to achieve our requirements:
var FindGroupMember = Class.create();
FindGroupMember.prototype = {
initialize: function() {
var grp = current.assignment_group;
var x; //Variable that will hold the group of members you want to show
//If Assignment Group is Group A then show members of Group B
if(grp=='<insert sys_id of Group A>'){
x = '<insert sys_id of Group B>';
}
//Code to return members of the group
var answer = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', x);
gr.query();
while(gr.next()){
answer.push(gr.user.toString());
}
return 'sys_idIN' + answer;
},
type: 'FindGroupMember'
};
HOW TO SETUP:
- Create a new script under System Definition > Script Includes
- Use the final code above
- Configure the Dictionary of Additional Assignee List field
- DO NOT change the setup on Reference Specification
- Go to Dictionary Overrides on the bottom of the page and click New
- Change table to Incident (this allows you to just change the lookup of Additional Assignee List field while you are on Incident table, on other tables, it will just work as OOB)
- Check 'Override reference qualifier'
- Paste the code below on the R
javascript:new FindGroupMember().initialize();
RESULTS:
When Assignment Group is Group A, then lookup for Additional Assignee List will return users of Group B.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 11:05 PM
Please find below update code, it will populate the user based upon the sys_id of the specific group.
var FindGrpMember = Class.create();
FindGrpMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupMember : function()
{
//var grp = current.assignment_group; //Pass the variable name which selects Group
var answer = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', <sys_id of group from where you need to have the list of users populated>);
gr.query();
while(gr.next()){
answer.push(gr.user.toString());
}
return 'sys_idIN' + answer;
},
type: 'FindGrpMember'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 11:19 PM
Thanks for this. How would this work if for example, we want to show users from group X when the Assignment Group is set to Group A or show users from group Y when Assignment Group is set to Group B?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 12:24 AM
Hello Jimboy,
Please let me know if you tried the provided code? If i get correctly then you want to show so the group member of a particular group irrespective whatever group you have selected. If yes,
please create the script include with provided code.
var FindGrpMember = Class.create();
FindGrpMember .prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupMember : function()
{
var answer = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', '0a52d3dcd7011200f2d224837e6103f2'); //sys_id of the group X (from where you want to display the list of members)
gr.query();
while(gr.next()){
answer.push(gr.user.toString());
}
return 'sys_idIN' + answer;
},
type: 'FindGrpMember '
});
and then configure the dictionary with Advanced Qualifier
once done then you will be able to see the member of mentioned group (provided sys_id of the group) in script.
Result:
Provided the sys_id of Application Development group which has 3 members in above script.
List of members in assign_to field
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 02:43 AM
Hope it helped you to solve the issue.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. https://community.servicenow.com/docs/DOC-5601

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 03:49 AM
Hi explorenow thanks for this, we used this and modified a bit to fit on our exact requirement.
For other users with this similar requirement, just refer to the steps below:
Here's the final script we used to achieve our requirements:
var FindGroupMember = Class.create();
FindGroupMember.prototype = {
initialize: function() {
var grp = current.assignment_group;
var x; //Variable that will hold the group of members you want to show
//If Assignment Group is Group A then show members of Group B
if(grp=='<insert sys_id of Group A>'){
x = '<insert sys_id of Group B>';
}
//Code to return members of the group
var answer = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', x);
gr.query();
while(gr.next()){
answer.push(gr.user.toString());
}
return 'sys_idIN' + answer;
},
type: 'FindGroupMember'
};
HOW TO SETUP:
- Create a new script under System Definition > Script Includes
- Use the final code above
- Configure the Dictionary of Additional Assignee List field
- DO NOT change the setup on Reference Specification
- Go to Dictionary Overrides on the bottom of the page and click New
- Change table to Incident (this allows you to just change the lookup of Additional Assignee List field while you are on Incident table, on other tables, it will just work as OOB)
- Check 'Override reference qualifier'
- Paste the code below on the R
javascript:new FindGroupMember().initialize();
RESULTS:
When Assignment Group is Group A, then lookup for Additional Assignee List will return users of Group B.