- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2016 10:38 AM
I'm unsure if this is possible, but, we have a user who would like to view all tickets opened by members of a specific group. So, the user could specify which group they wanted, and it would show all the tickets opened by all members of that group. I believe it could be an additional requirement to specify whether the ticket is open/closed, but I'm stuck on this first portion as I'm not sure it can be done!
My attempt to achieve this was to use a business rule "getGroupMembers," and create a report using something similar to this JS call: where Opened By IS javascript:getGroupMembers(<group name>)
Apologies in advance if this is a duplicate; and I'm just getting into Service Now within the past month, so my experience is still limited! Thank you to anyone who could possibly point me in the right direction, your help is much appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 01:39 AM
Below is the dynamic filter Options I have created for the same purpose:
From navigation panel, System Definition --> Dynamic Filter Options --> Click New
Now in the filter condition, if is(dynamic) is selected then you will have an option of the dynamic filter.
Script Include Code:
function getMyGroupMembers(){
var myGroups = gs.getUser().getMyGroups();
var groupsArray = new Array();
var it = myGroups.iterator();
var i=0;
var groupMemberArray = new Array();
while(it.hasNext()){
var myGroup = it.next();
//Query for group members
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('group', myGroup);
//Only return active users
grMem.addQuery('user.active', true);
grMem.query();
while(grMem.next()){
//Add to user sys_id to array
groupMemberArray.push(grMem.user.toString());
}
i++;
}
return groupMemberArray;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2016 01:55 AM
My requirement was to get the Group members of my groups. So I have not specified any group name here. You have to play something with the above script include to get you requirement done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 09:14 AM
Not working for me .. any help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 08:07 AM
Try something like below in the script include.
var groupMemberArray = new Array();
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('group', '<sys_id of the group you want>'); //here put the sys_id of the group you want.
grMem.addQuery('user.active', true);
grMem.query();
while(grMem.next()){
//Add to user sys_id to array
groupMemberArray.push(grMem.user.toString());
}
return groupMemberArray;
It should work. Let me know the result.