- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:09 PM
Hello,
Is there a way to filter the module to only include groups that I am a member of and of a certain type?
For example on, My Groups Work, since I do not have an admin role, I need to only see 3 groups on the filter instead of 4 groups since the Change Manager group does not have an itil type.
Is there a way to hide this if the user is not admin?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 03:50 PM
Please modify the code as below
function getMyGroupsCustom()
{
var ids = [];
var uID = gs.getUserID();
var isAdmin=gs.getUser().hasRole('admin');
var grmember = new GlideAggregate('sys_user_grmember');
grmember.addQuery('user', uID);
grmember.addQuery('group.active', true);
if(!isAdmin)
grmember.addEncodedQuery('group.typeNOT LIKE2e763549d7111100828320300e61038d');
grmember.groupBy('group');
grmember.query();
while(grmember.next())
{
ids.push(grmember.group.toString());
}
return ids;
}
Add the highlighted code in your script include, it will work as you are expecting.
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
Regards,
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:12 PM
Hi,
Add additional condition in the query assignment_group.type ="your_type".
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
Regards,
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:14 PM
If I do this then I can still see the Change Manager on the filter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:26 PM
Please share the screenshot.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:34 PM