How to get number of incidents raised by each user. And how many active users raised zero tickets?

nausheen
Kilo Contributor

How to get number of incidents raised by each user. And how many active users raised zero tickets?

Thanks.

3 REPLIES 3

Gabor10
Mega Guru

I have just made this server side snippet, execute it as a Background Script (or any server side component) to check

var ga = new GlideAggregate('incident');
var arr = [];
ga.addAggregate('COUNT', 'caller_id');
ga.groupBy('caller_id');
ga.query();
while (ga.next()) {
    arr.push(ga.getValue('caller_id'));
    gs.print(ga.getDisplayValue('caller_id') + " has " + ga.getAggregate('COUNT', 'caller_id') + " incidents");
}



var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', 'NOT IN', arr);
gr.addQuery('active', true);
gr.query();
while (gr.next()) {
    gs.print(gr.name + " has 0 incidents");

}

Saurav11
Kilo Patron
Kilo Patron

Hello,

Are you trying to get this by scripting or report?

Jaspal Singh
Mega Patron
Mega Patron

Hi Nausheen,

 

 

You can create a simple report as below

find_real_file.png

 

Where obviously you can change the Greater than or Equal to as per your need.