- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 03:39 AM
Hello Everyone,
I have a requirement where i need to check wheather the incident are closed or not, i have more than 1000 records how to run the background scirpt to get count in one shot.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 03:49 AM
Hey Irfan,
You can form the queries in the query builder of the incident list . and then copy the query. by right clicking the filter and copy query like shown below
No write your script.
var gr = new GlideRecord('incident');
gr.addEncodedQuery('incident_stateIN6,7');
gr.query();
while(gr.next()){
// do something;
}
Thanks,
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 03:49 AM
Hey Irfan,
You can form the queries in the query builder of the incident list . and then copy the query. by right clicking the filter and copy query like shown below
No write your script.
var gr = new GlideRecord('incident');
gr.addEncodedQuery('incident_stateIN6,7');
gr.query();
while(gr.next()){
// do something;
}
Thanks,
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 04:21 AM
Thanks Sanjay,
Can you please let me know when i run the background scirpt i am getting as Complete i want see the INC number what should i add
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 03:49 AM
Use GlideAggregate :
var count = new GlideAggregate('incident');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if (count.next())
incidents = count.getAggregate('COUNT');
Add the encodedquery as per your need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 04:04 AM
Where to add Encoded query ?
