Repair SLA via fix script

Mikhail Kotov
Mega Contributor

I can't repair SLA using fix script. When I run it new SLA is not created. My script:

var gr = new GlideRecord("hr");
gr.get("3cd5888adb7190505f23d0a1ca96199e");
var repair = new SLARepair();
repair.repairByFilter(gr.getEncodedQuery(), gr.getRecordClassName());

SLA Definition:
find_real_file.png
find_real_file.png
find_real_file.png
find_real_file.png
Task:
find_real_file.png
find_real_file.png
The same when I click "Repair SLA". Can anyone help?

Regards,
Mikhail

 
2 REPLIES 2

Ashley Snyder1
Giga Guru

Be very careful when repairing SLAs and try to test in a sub-development environment if possible.  There's a lot that can go wrong if not done properly, i.e. notifications shooting out, etc.

You can repair SLAs from the list view, I would recommend using the OOTB methods rather than trying to use a Fix Script. 

Also ensure the property for using the Repair SLA workflow is turned on prior to attempting to repair, else it may try to use the original SLA workflow.

https://docs.servicenow.com/bundle/paris-it-service-management/page/product/service-level-management...

 

Thank you, @Ashley Snyder,

I'm testing it in a development environment. We created "SLA definition" for hr table (task child) recently. Now I need to repair SLA for old hr records that have been closed before we created "SLA definition". So It doesn't work using the OOTB methods or a Fix Script but it works for new hr records, that have been created after we created "SLA definition". The property for using the Repair SLA workflow is turned on.

I think maybe something wrong with "SLA definition".

Regards,
Mikhail