
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 04:53 AM
How to check total ticket(incident) assigned to currently login user by using script?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 05:23 AM
here we go.
sample script , just to check incident.
you can check any other table as well. make the modification based on your need.
var count=0;
var gr = new GlideRecord('incident');
gr.addEncodedQuery('stateNOT IN6,7,8');
gr.addQuery('assigned_to',gs.getUserID());
gr.query();
while(gr.next())
{
count++;
gs.print(gr.number);
}
gs.print(count);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 05:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 05:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 05:14 AM
Hi,
you need to use GlideAggregateAPI.
For more detail see it.
https://docs.servicenow.com/bundle/london-application-development/page/app-store/dev_portal/API_reference/GlideAggregate/concept/c_GlideAggregateAPI.html#r_GlideAggregate-getAggregate_String_String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 05:15 AM
Hi Ankit,
Try below script in Background scripts to get total incidents assigned to currently logged in user.
var gr = new GlideRecord("incident");
gr.addQuery("assigned_to",gs.getUserID());
gr.query();
var count = gr.getRowCount();
gs.print(count);
Regards,
Devyani