How do you cancel a completed SLA when state changes from Resolved back to Open
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2023 03:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2023 10:33 PM
Hi @Sarah Barnes ,
You can't cancel a completed SLA. You instead need to look at your conditions, so the SLA fist complete when the incident is closed and can't be reopened again. it could be that you should set SLA 1 in a pause state when resolved and move it to completed when incident is closed.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2023 12:59 PM
If my answer has helped with your question, please mark my answer as accepted solution.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2023 01:25 AM
Thanks Anders, I had already realised that it won't cancel on the complete, so we have created a flow with a field so we can report on the most recently created SLA - which was the reason for my question.
Much appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2023 01:39 AM
Hi,
var taskSLAs = new GlideRecord('task_sla');
taskSLAs.addQuery('task', 'TASK_SYS_ID'); // replace TASK_SYS_ID with the sys_id of the task you want to query
taskSLAs.query();
var lastCompletedSLA = null;
while (taskSLAs.next()) {
var slaHistory = new GlideRecord('task_sla_history');
slaHistory.addQuery('task_sla', taskSLAs.sys_id);
slaHistory.orderByDesc('end_time');
slaHistory.setLimit(1);
slaHistory.query();
if (slaHistory.next() && slaHistory.getValue('breached') == false) {
lastCompletedSLA = slaHistory;
break;
}
}
if (lastCompletedSLA != null) {
// use lastCompletedSLA to report on the SLA
}
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar