Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
SLA - Bulk Repair Option - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • SLA - Bulk Repair Option
KB0720480

SLA - Bulk Repair Option


11063 Views Last updated : Nov 7, 2024 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

How to do Bulk SLA Repair 

Cause

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. 

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


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.