Populate user names depending upon the selected group name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 07:10 AM
I've a catalog item which contains a variable 'Select Governance Group' which is a 'reference' type and which is referred to a custom table "u_rlm_governance_group".
I've an another variable 'Name of members to be removed from Governance Group' which is a 'list collector' type.
My requirement is to above variable should contains all the user names depending upon 'Select Governance Group' reference group. If I change the 'Select Governance Group' name, then user names available should be updated in 'Name of members to be removed from Governance Group' variable.
How I can achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 04:00 PM
Hello @Bijay Kumar Sha
In "Name of members to be removed from Governance Group" variable currently all user's are populating in it or it's just a filter?
Murthy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 02:03 AM
Hi @Murthy Ch , currently in the reference qualifier, I've referenced it to the user table only which is showing all the user names.
But I want above variable should contains all the user names depending upon 'Select Governance Group' reference group. If I change the 'Select Governance Group' name, then user names available should be updated in 'Name of members to be removed from Governance Group' variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 02:43 AM
Hi @Bijay Kumar Sha ,
You can do the following.
1. Create one script include to get the list of member based on selected group.
listOfMember: function() {
var group= this.getParameter('sysparm_group');
var grpMember= [];
var grMem = new GlideRecord('Table name of your group and user mapping');
grMem .addQuery('group', group);
grMem .query();
while (grMem .next()) {
grpMember.push(grMem .sys_id.toString());
}
return grpMember.toString();
},
2. Create catalog onchange client script
if (isLoading) {
return;
}
if (newValue === '') {
g_form.clearValue('your variable name');
}
var ga = new GlideAjax('getGRPMem');
ga.addParam('sysparm_name', 'listOfMember');
ga.addParam('sysparm_group', newValue);
ga.getXML(populateValues);
function populateValues(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('your variable name);
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------