Mass close Remediation Tasks

mattystern
Kilo Sage

Hi all,

We have around 62000 remediation tasks which all need to be closed. I first tried using "update all" to update their "state" values to "closed completed." However, this times out and only closes around 3000 records before timing out. So next, I tried to run a background script where I use an EncodedQuery on the task table, but in Dev, my background script was timing out (reached 4 hours) and did not close all records. Is there a way to identify which business rule(s) or script(s) are taking a long time to process? Are there places I should check to make sure there aren't going to be spam notifications to the fulfillment team?

Thanks for any advice!

1 ACCEPTED SOLUTION

Chris McDevitt
ServiceNow Employee
ServiceNow Employee

Hi,

 

Ideas...

  • Do this in smaller chunks
  • Put this in a Fix Script so it can run longer
  • Use gr.setworkflow(false) to stop the Business Rules from running on the Remediation Task table
    • Then use the "Auto-Close Vulnerable Items" to close the VITS

 

 

View solution in original post

9 REPLIES 9

Chris McDevitt
ServiceNow Employee
ServiceNow Employee

Hi,

 

Ideas...

  • Do this in smaller chunks
  • Put this in a Fix Script so it can run longer
  • Use gr.setworkflow(false) to stop the Business Rules from running on the Remediation Task table
    • Then use the "Auto-Close Vulnerable Items" to close the VITS

 

 

Hi Chris,

 

When I filter the remediation tasks by last seen (for example last 30 days or 60 days or what ever ), I would like to close those tasks via scheduled job . 

Currently I am using Scheduled script for closing last seen 30 days of tasks. I would like to add script when dynamic filter applies for last seen  and close out tasks, Scheduled job should take it accordingly. How to modify the script when the last seen filter changes dynamically ? 

 

TIA

 

Hi,

 

So.... I think I understand..... So, I would use an encodedQuery():

some_field_name<javascript&colon;gs.beginningOfToday()

Which would make it dynamic.

 

Build the correct query on the table with the Condition Builder, run the query and then copy the query and use it in you script.

Would this method be necessary to reassign 1500 remediation tasks? I'd like to change the assignment groups,but don't have the bulk edit option like VITs.