- 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
‎08-31-2016 01:00 AM
I think one way of doing this is by using a Dynamic Filter option:
Create a dynamic filter option
with a script filter:
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2016 06:45 AM
Thank you Sergiu! I actually didn't even think of using a dynamic filter, so thank you very much for this!
- 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-01-2016 06:43 AM
Thank you @Tanumoy! Do you have the ability to specify which group you want to see results for? I believe this is almost what we're attempting to achieve, minus the specifying which group I want to run the report as. Thanks!