- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2023 09:36 AM
I need a background script such that it should provide a list of groups that have ITIL role under two cases.
1. ITIL role directly added to the group
2. ITIL role contained in another role and that role is added to the group
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 04:56 AM
Hi @gunashalini
Please try like this you will get list of groups
var gr = new GlideRecord('sys_group_has_role');
gr.addEncodedQuery('roleLIKEext.resMgr^ORroleLIKErestMgrMain'); // apply filter of what roles you need to query from above table then copy the query and call in encoded query
gr.query();
while(gr.next()){
gs.print(gr.group.getDisplayValue()); // get list of group names that have ITIL role
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 04:56 AM
Hi @gunashalini
Please try like this you will get list of groups
var gr = new GlideRecord('sys_group_has_role');
gr.addEncodedQuery('roleLIKEext.resMgr^ORroleLIKErestMgrMain'); // apply filter of what roles you need to query from above table then copy the query and call in encoded query
gr.query();
while(gr.next()){
gs.print(gr.group.getDisplayValue()); // get list of group names that have ITIL role
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2023 06:28 AM
Thanks for your help @yaswanthi2