The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to change SLA stage manually?

SK36
Tera Contributor

Hi,

My SLA is currently showing "in progress" even though the ticket got cancelled. because I forgot to give the cancel condition. 

 

Now I added cancel condition, but still the ticket's SLA remains in "in progress" stage. How to change it manually?

because, it is showing in my dashboard even though the ticket got cancelled.

 

Can anyone help me in this?

7 REPLIES 7

mush
Tera Guru

It's the task_sla table where you'll want to update the stage field. You can write a simple script with a query to set the stage to 'cancelled'. Update your query as you see fit. I've commented out the actual update and set a limit that only returns two records but you can modify it.

var taskSlaTable = 'task_sla';
var cancelledStage = 'cancelled';
var encodedQuery = "stage=in_progress";

var incidentGr = new GlideRecord(taskSlaTable);
incidentGr.addEncodedQuery(encodedQuery);
incidentGr.setLimit(2);
incidentGr.query();

while (incidentGr.next()) {
incidentGr.setValue('stage', cancelledStage);
//incidentGr.update();
gs.info(incidentGr.task.number + ' ' + incidentGr.stage);
}
gs.info('Number of incidents cancelled: ' + incidentGr.getRowCount());





saikiranyadav1
Tera Contributor

We could not able to change the Stage Field in 'task_sla' because there is a defined acl which is been made by servicenow and could not be editable.

I have tried changing the Stage Filed through various ways but could not able to change the behaviour.

If you find any kind of Solution please let me know

I had a similar challenge but wasn't able to find a way to update the task_sla table, in the end it was easier to re-open and cancel/close the associated tickets and let the SLA definitions update it.  Good luck...