- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 10:16 PM
I wanted to filter out the active groups with no members and roles.
I navigated to sys_user_group and when i tried out the filters, i could get the active groups with no members. But i cant filter out the groups with no roles.
I tried the filter 'Group. Roles' is 'empty'. But not showing up the results.
Could anyone please help me?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:37 PM
add this related list condition along with active is true and group members is 0 filter
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 10:29 PM
Hi
For
- Group roles, you can query on table "sys_group_has_role"
- Member, you can query on table "sys_user_grmember"
So you can use these 2 tables and get the details.
Please mark my answer as correct if this solves your issues!
If it helped you in any way then please mark helpful!
Thanks and regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:12 PM
Hi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:45 PM
Hello
Try something like this and call it in your report:
getActEmptyGrps: function() {
var arrG = [];
var grA = new GlideRecord("sys_user_group");
grA.addActiveQuery();
grA.query();
while (grA.next()) {
var grG = new GlideAggregate("sys_user_grmember");
grG.addQuery("group", grA.getUniqueValue());
grG.addAggregate("COUNT");
grG.query();
if (grG.next()) {
if (grG.getAggregate("COUNT") == 0) {
var grR = new GlideAggregate("sys_group_has_role");
grR.addQuery("group", grA.getUniqueValue());
grR.addAggregate("COUNT");
grR.query();
if (grR.next()) {
if (grR.getAggregate("COUNT") == 0) {
arrG.push(grA.getDisplayValue());
}
}
}
}
}
return arrG.toString();
},
In Report your filter condition would be like below:
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2022 11:47 PM