Any way to filter javascript:getMyGroups() results to target only groups that are of type "Assignment"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 12:16 PM
Hi Everyone,
I'm realizing that a lot of my users are using the "My group work" gauge. We're currently testing Kingston in our pre-prod instance and, given that we import all AD groups into service now, the resulting visible filter at the top is unnecessarily long. I know gauges aren't technically supported anymore, but, as much for this situation as for others in the future, I was wondering if there is any to provide parameters to the the javascript:getMyGroups() function that would filter exclusively on groups where type = assignment. Is there a quick way to do this, or am I looking at replacing the gauge with a custom made report that would act as described?
My continued appreciation to this community, you're a valuable resource!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 12:22 PM
Hi,
You should be able to open up the gauge and add a new filter to that? Is there like a gear icon or something for you to edit the parameters and just add type is Assignment?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 12:30 PM
getMyGroups is a function defined in an out of the box business rule called "groups, banners". You can edit this function but touching out of the box business rules will require you to be mindful of this during future upgrades.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 12:48 PM
Thanks for your replies guys!
Michael, absolutely. I don't think I would want to edit it outright, perhaps create a copy and go from there. Thanks for pointing me in that direction.
Allen, I've tried editing the gauge, but the properties being offered are related to the task table and there doesn't seem to be a way to dot walk from there to address assignment group properties directly... (see below)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2018 02:23 PM
Pierre, to help with upgrades you could create your own function and leverage that or if you could completely replace it. Here is an example function that should work:
function getMyGroups2() {
var answer = [];
var userGroups = gs.getUser().getMyGroups().toString();
var groupRec = new GlideRecord("sys_user_group");
groupRec.addQuery("sys_id", "IN", userGroups);
groupRec.addQuery("type", "CONTAINS", "SYS-ID-OF-GROUP-TYPE-FOR-ASSIGNMENT"); //Assignment
groupRec.query();
while (groupRec.next()) {
answer.push(groupRec.sys_id.toString());
}
return answer;
}