
- 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:23 AM
Hi,
the above code will give count of all incidents assigned to the logged in user (Active+inactive incidents).
Add gr.addActiveQuery(); to get only active incidents.
Thanks.

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