- 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 02:37 AM
Hi @LaraReddy
Look like you are referring to Parent -child relationship.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 03:49 AM
Hi @LaraReddy
Assuming you have userGroup variable in your catalog item, you can make use of Advanced Reference Qualifier to populate group users -
javascript:'group='+current.variables.userGroup;
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 04:51 AM - edited ‎11-08-2024 04:53 AM
Hi ,
Thanks for the response.
We created below script include on Global application level and called the same on VA application level.
},
Under second variable reference qualifier level we called as:
javascript: new global.getGroupMembers().getGroupUser(current.variables.assignment_group);
Note: First variable referred to Group table and second variable referred to Group members table.
But still not listing the users , Could you please check the script and let us know.
Advance thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2024 05:38 AM
You can refer below post for the Script Include code. Please note that the Script Include should be client callable.
Though I will still recommend you the use the Advanced Reference Qualifier which I shared above. It will be more easy to implement.
javascript:'group='+current.variables.assignment_group;
Please mark this response as correct and helpful if it assisted you with your question.