- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 02:34 AM
Hi All,
We do have a catalog item with two Reference type variables.
Now if on the first variable if we select any group then on the second variable level we need list out above selected group users.
Advance thanks.
Note: We tried the auto populate related section on the second variable level but it's not working.
Version = Washington DC.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 05:59 AM
Hi @LaraReddy ,
You can configure like below.
Script include code:
var userUtils = Class.create();
userUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupMembers: function(group) {
gs.log('Runjay'+group);
var sysId=[];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', group);
gr.query();
while (gr.next()) {
sysId.push(gr.user.sys_id);
}
return 'sys_idIN'+sysId;
},
type: 'userUtils'
});
Output.
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 05:59 AM
Hi @LaraReddy ,
You can configure like below.
Script include code:
var userUtils = Class.create();
userUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupMembers: function(group) {
gs.log('Runjay'+group);
var sysId=[];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', group);
gr.query();
while (gr.next()) {
sysId.push(gr.user.sys_id);
}
return 'sys_idIN'+sysId;
},
type: 'userUtils'
});
Output.
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 08:25 AM
Hi @LaraReddy ,
Hope provided solution worked for you if yes then please accept the solution if not then let me know what issue still you are facing.
Happy to help you.