How to stop SLA without removing setworkflow in BG script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 02:11 AM
Hi Team,
We have a requirement to close bulk incidents through background script.
Script:-
var gr = new GlideRecord('incident');
gr.addQuery('your_criteria_field', 'your_criteria_value');
gr.query();
while (gr.next()) {
gr.setValue('incident_state', '7');
gr.setValue('close_code', 'your_close_code');
gr.setValue('close_notes', 'Your closing notes');
gr.setWorkflow(false);
gr.update();
}
By using this above script. we are able to close the incidents. But still SLA is running. How to stop SLA without removing setworkflow(false).
Kindly please help on this.
Thanks for the advance.
Thanks,
Saikrishna

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 02:26 AM
Hello @thaduri sai
You can repair SLA using the UI action in incident list. Open incident list > filter the list > select all > action > Repair SLA.
Below thread explains about repair SLA through fix script: https://www.servicenow.com/community/developer-forum/repair-sla-via-fix-script/m-p/1843836
Thank you,
Ali
Thank you,
Ali