Notifications

50 views

Symptoms


SLA - Bulk Repair Option

Release


Kingston Patch 7

Cause


There could be many reasons for choosing 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. 

Resolution


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(); 

slaRepair.setValidateOnly(true); 

slaRepair.repairByFilter(incidentQuery, "incident"); 

if (slaRepair.validateOnly) 

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 report 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);" 

 

Article Information

Last Updated:2018-12-14 12:17:02
Published:2018-12-14