- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:37 AM
Im trying to create a cusom dynamic filter to show only the incidents that Assignment group is one of user's groups (without parent group).
For some reason it only shows me one group among the groups that i belong to.
I can only see the incidents of one of my groups instead of the two of them:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:00 AM
Hi @Alon Grod,
Then it probably is OOTB in some plugin installed in my instance.
This is the underlying code, which you can use:
/**
Default filter "One of My Groups - d6435e965f510100a9ad2572f2b47744" includes parent groups too
As per defect "DEF0173629" we want only groups the user is part of not parent groups
*/
getGroupsIAmMemberOfExcludeParents: function(userId) {
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.addQuery('group.active', true);
gr.query();
while (gr.next()) {
var groupId = gr.getValue('group');
if (!gs.nil((groupId)))
groups.push(groupId);
}
return groups;
},
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:22 AM
Hi @Alon Grod,
No need to use javascript: int the script field here just use (assuming you are not changing the script include name you already have, and will use this script I sent you)
new getGroups().getGroupsIAmMemberOfExcludeParents(gs.getUserID());
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:22 AM
Hi @Alon Grod,
No need to use javascript: int the script field here just use (assuming you are not changing the script include name you already have, and will use this script I sent you)
new getGroups().getGroupsIAmMemberOfExcludeParents(gs.getUserID());
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 08:32 AM
@Peter Bodelier thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2023 12:48 AM
@Alon Grod Happy to help
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.