how to get count of total incidents in system logged

ganjimahesh
Tera Contributor

Total count of incident/SRs in system

8 REPLIES 8

snehabinani26
Tera Guru

You to navigate to any table and check the total count.



Let me know your requirement in details, where/how you want this count


I need the code to get the total count of the incidents/SRs logged in the system.


Hi Mahesh,



Try this in Background script : It gives total number of incidents



var count = new GlideAggregate('incident');


count.addAggregate('COUNT');


count.query();    


if(count.next()) {


    gs.print(count.getAggregate('COUNT'));


}



Thanks,


Syed Farhan


Hi Mahesh,



You can have a script like this to run in Background script or where ever you want.



var gr = new GlideRecord("table_name");


gr.query();


var count = gr.getRowCount();


gs.log(count);