How to report on incidents opened by a particular group?

Dave Moulds
Tera Contributor

This question was asked in previous releases when you could reference a javascript business rule to filter your results, but has since become unavailable with newer releases.  

We are using Kingston.

So, how would one generate a list of incidents that was opened by a particular group without explicitly identifying all the group members in the filter?  eg. "Opened by" is groupMember of "Service Desk"

Thoughts? 

12 REPLIES 12

Hey,

 

You will not be able to use current.opened_by in your list view, that's the filter for your business rule.

 

You can use stuff like:

 

[Short Description] | is | javascript:testFilterSD()
[Company] | is not empty
[Close Notes] | is | javascript:testFilterCN()
[Assigned To] | is not | javascript:gs.getUserID()

 

You can also use stuff like URL Filters: 

Please modify them accordingly.

 

URL filter or query parameters are in the format of:
sysparm_query=caller_id%3D46c6f9efa9fe198101ddf5eed9adf6e7%5Epriority%3E3

So this link...
https://demo.service-now.com/incident_list.do?sysparm_query=caller_id%3D46c6f9efa9fe198101ddf5eed9adf6e7%5Epriority%3E3

Rahul Shandily3
Giga Guru

Hi there,

 

Use the below code and you should get your results.

 

1. Created a Script Include

find_real_file.png

Name = groupMember

Client Callable = true

Script

var groupMember = Class.create();
groupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getMember: function(grmember){
var mbrs = "";
var gr = new GlideRecord("sys_user_group");
gr.get("name",grmember);

var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('group', gr.sys_id);
grmember.query();
while (grmember.next()) {
mbrs += grmember.user.user_name.toString();
if(grmember.hasNext())
mbrs += ",";
}

return mbrs;

},

type: 'groupMember'
});

 

2. In your Incident List or Report choose this 

find_real_file.png

Created By is one of javascript:new groupMember().getMember("Service Desk");

 

This works for me. Instead of Service Desk, you can give group name of your choice and it will pull all the members of that group. I believe this was your requirement.

 

Best Regards,

Rahul

Please mark Correct / Helpful if it worked for you.

Hi,

This works fine with 'Created by' where 'is one of' is possible but what do you do if you want 'Opened by' instead? There's no 'is one of' on 'Opened by' and you can't call a javascript in an 'is' statement.

Best regards

Ahh, I found out. Dot walking to Request > Requested for > User ID where 'is one of' is possible.

Piggy backing off this comment for further clarification (this was helpful so thanks Thomas!)

You can dot walk to report on any reference field using this function.

EX:
find_real_file.png