incident table

soniya patil
Tera Contributor

how to get count of incident assigned to able tuter

5 REPLIES 5

Nayan  Dhamane
Kilo Sage
Kilo Sage

Hello @soniya patil ,

Please use below script:

var count=new GlideAggregate('incident');
count.addAggregate('COUNT');
count.addQuery('assigned_to','sys id of abel tutor')
count.query();
while(count.next()){
    gs.info(count.getAggregate('COUNT'));
}
If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

Harish Bainsla
Kilo Patron
Kilo Patron

hi please check below code and mark helpful and accept solution if you got answer


var gr = new GlideRecord('incident');

gr.addQuery('assigned_to', '62826bf03710200044e0bfc8bcbe5df1');
gr.addQuery('state', '1');
gr.query();
var incidentCount = gr.getRowCount();

gs.info('Number of incidents assigned to able_tutor: ' + incidentCount);

shivangi k
Kilo Sage

Hi @soniya patil ,

 

Use below mentioned code:

var count= new GlideAggregate("incident");
count.addAggregate('COUNT');
count.addQuery('assigned_to','62826bf03710200044e0bfc8bcbe5df1');
count.query();
while(count.next()){
    incidents = count.getAggregate('COUNT');
   gs.info(incidents);
}
 
Please mark helpful and accept solution if it helped you.
 
Regards,
Shivangi

Ankur Bawiskar
Tera Patron
Tera Patron

@soniya patil

From what I could see in your recent posts, you are asking simple and straight questions.

Answers to that can be easily found on ServiceNow docs page.

Did you try to explore there before posting question?

https://docs.servicenow.com/ 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader