Is it possible to update the Stop Date of a task SLA to match the Resolve Date of an incident record whilst running Fix SLAs?

matthew_hughes
Kilo Sage

Hi,

On our instance we're wanting the 'Fix SLAs' functionality to update the Stop Time of the related Task SLAs to match the Resolved Date in the incident as the new Task SLA is created. I was just wondering if this was possible to do because at the moment, the Stop Time of a Task SLA matches the date and time when the incident gets set to 'Closed State'.

At the moment this occurs;find_real_file.png

 

find_real_file.png

find_real_file.png

 

What we would like to happen when the 'Repair SLAs' function is ran:

find_real_file.png

 

find_real_file.png

 

if somebody could please how I would need to implement the repair SLA function, but allow the Stop Date to match the Resolved Date, that would be great. My script is:

var tab = new GlideRecord('task_sla');
//Searches for the affected incident SLAs
tab.addEncodedQuery("task=1c741bd70b2322007518478d83673af3");
//Runs the query
tab.query();
//Helps in prevent running of BR's while updating
tab.setWorkflow(false);
//While it's looping through the records
while(tab.next()){
tab.end_time = tab.task.ref_incident.resolved_at;
tab.update();
}

20 REPLIES 20

Hi Matthew,

No problems! Would you mind making my last script answer as correct for this, as I believe the script fits the requirements and may be useful for any future readers searching something similar 

Cheers

Dan