How to do Bulk SLA Repair
There could be many reasons for choosing a bulk repair option, for instance the SLA records (contract_sla) got deleted and that caused a cascade delete of all the related Task SLA records. This has caused many incidents to have their Task SLA record removed.
SLA Repair can be called from script to perform bulk repairs of SLAs - you can call it with an encoded query and a specific task type.
Please find below example script to do this is:
var incidentQuery = "...paste encoded query here...";
var slaRepair = new SLARepair();
gs.log("SLARepair run in validate only mode - found " + slaRepair.taskIds.length + " Incident records to repair", "SLARepair");
A new "sysauto_script" record ("automatically run a script of your choosing") can be created with run type set to "On demand" and the script above. Then whenever you are ready to try it, you can use the "Execute now" button to start it.
The script above won't do anything apart from reporting the number of records it has found to repair (this will appear in the system log with a source of "SLARepair").
To modify the script above to actually perform the repairs, just comment out the line "slaRepair.setValidateOnly(true);"