Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Highest number of incidents created

servicenow14710
Tera Expert

Hello developers, 

I need to get the highest number of incidents created by a particular person. Any help is appreciated, Thanks!

2 REPLIES 2

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

And in what setting? Scripted? Something else?

 

You could query matching the particular person + the opened on and order by that date descending.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

dgarad
Giga Sage

Hi @servicenow14710 

 Refer to the below script.

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");
}

 

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad