how to bulk close incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 11:55 PM
how to bulk close incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 03:54 AM
Hi,
Best Option would be to write a Background Script to close the incidents required from back end and setting the workflow as well as to false so that no Notifications gets triggered while closing the Incidents as per the script mentioned below:
Script:
var gr = new GlideRecord('incident');
var string='active=true^state=2'; //Replace your Query here
gr.addEncodedQuery(string)
gr.query();
while(gr.next())
{
gr.setWorkflow(false); //This would not allow any Notifications to get trigger while closing
gr.autoSysFields(false);
gr.state = 10; //Replace your Closed State value here
gr.update();
}
In the code shared above you can get your Query required by simply Navigating to the list view of incidents and filter the Records which you want to close and then Run the filter. Post Run Right click on the query and copy the same as shown below:
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2017 04:47 AM
One thing to remember if you are playing with state on incident.
Always keep the incident state and state in sync. So if you are going to use "gr.setWorkflow(false)" (which is good to use if you updating records in multiple )
then manually set incident state in the script as well. So your final script will be :
var gr = new GlideRecord('incident');
var string='active=true^state=2'; //Replace your Query here
gr.addEncodedQuery(string)
gr.query();
while(gr.next())
{
gr.setWorkflow(false); //This would not allow any Notifications to get trigger while closing
gr.autoSysFields(false);
gr.state = 4;
gr.incident_state = 4 //Replace your Closed State value here
gr.update();
}