incident table

soniya patil
Tera Contributor

how to get count of incident assigned to able tuter

5 REPLIES 5

Kapil Khedkar
Tera Contributor

Hi @soniya patil,

Please find below the script for your query.

 

var sysId = 'user_sys_id_here';

var grIncidentCount = new GlideAggregate('incident');
grIncidentCount.addQuery('assigned_to', sysId);
grIncidentCount.addQuery('active', true); 
grIncidentCount.addAggregate('COUNT');
grIncidentCount.query();

if (grIncidentCount.next()) {
    var incidentCount = grIncidentCount.getRowCount();
    gs.addInfoMessage("Total Incidents Assigned: " + incidentCount);
} else {
    gs.addInfoMessage("No incidents found for the given user.");
}

 

Thanks,

Kapil Khedkar

Please do the needful if you find this solution helpful.