Reporting on Incident Opened by a Member of a Group?

spaceyjacey
Kilo Contributor

We have many members of each group and we want a report on all incidents opened by members of a particular group. The only way we are able to run the report is to filter:

"Opened by - is - Brian - OR Opened by - is - Craig - OR Opened by - is - Alex - OR and so on..."

Is there a way to filter "Opened by - is - a member of 'Service Desk'?"

22 REPLIES 22

john_roberts
Mega Guru

You could use a similar process as getMyAssignments function that gathers delegate tasks.
Create a global business rule with a function to get group members for a given group.



function groupMembers(grpName) {
var mbrs = new Array();
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('group.name', grpName);
grmember.query();
while (grmember.next()) {
mbrs.push(grmember.user.toString());
}
return mbrs;
}


Then your filter would be:
Assigned to is javascript:groupMembers('Service Desk')

When the filter runs it will resolve to the list of group members and match records where assigned to is anyone in the group.


[quote=john.roberts]You could use a similar process as getMyAssignments function that gathers delegate tasks.
Create a global business rule with a function to get group members for a given group.



function groupMembers(grpName) {
var mbrs = new Array();
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('group.name', grpName);
grmember.query();
while (grmember.next()) {
mbrs.push(grmember.user.toString());
}
return mbrs;
}


Sir John Roberts,
To us mere mortals you are a demigod 😉
Thanks!


Hi John,



For some reason, this works on the 'assigned_to' but not the 'opened_by' field.



Any suggestions?



Regards,



RV


C_Hick
Tera Contributor

Did you ever get a response?   I have the exact same requirement -   report on who opened the incident....


Hi Cindy,



I was able to do with the following:




1. 1. Create Global Business Rule called 'getGroupMembers' with the following script:


2.


3. function groupMembers(grpName) {


4. var mbrs = new Array();


5. var grmember = new GlideRecord('sys_user_grmember');


6. grmember.addQuery('group.name', grpName);


7. grmember.query();


8. while (grmember.next()) {


9. mbrs.push(grmember.user.toString());


10. }


11. return mbrs;


12. }



2. Using the following javascript in a report to get the desired result:


Opened By = javascript:getGroupMembers('ENTER GROUP NAME')



1.


2. Let me know if you have any issues.



Regards,



RV