
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 11:56 AM
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!
Solved! Go to Solution.
- Labels:
-
Vulnerability Response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 12:17 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 01:00 PM
Hi @jremt
I think this would work in a background script/fix script! Just make sure to use this line on your glide record:
gr.setworkflow(false)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 01:06 PM
i'm not a developer in SNOW. Is there a way on the UI that I can do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 05:00 AM
From the Remediation Task List view, you can edit the Assignment group field my selecting it, changing it and then clicking the green check mark.
For selection of multiple you can CTRL + Click and drag. This will updated multiple records at the same time, see below 5 records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 02:41 PM
Hi,
You can use the updateMultiple() method with result set object, like below.
gr.setworkflow(false)
gr.updateMultiple();
Thanks,
Ashish
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 02:02 PM
Execute a fix script that runs in the background
/*You can close the Vulnerable Items*/
var chgMgr = new sn_vul.VulnerabilityStateChangeManager();
var vul = new GlideRecord('sn_vul_vulnerable_item');
vul.addEncodedQuery('active=true^last_foundRELATIVELE@dayofweek@ago@14');
vul.query();
while (vul.next())
{
var desired_state = 3;
var substate = 4;
var close_notes = "Auto-Closed by vr.system as the scanner did not report this vulnerability for more than 14 days.";
chgMgr.handleStateChangeRequest(vul, desired_state, substate, close_notes);
vul.update();
}
/* Remediation Tasks closing */
var gr = new GlideRecord("sn_vul_vulnerability");
gr.addEncodedQuery('active=true');
gr.query();
while (gr.next()){
gr.state = 3;
gr.work_notes = gs.getMessage("Auto-Closed by vr.system as the scanner did not report this vulnerability for more than 14 days");
gr.setworkflow(false)
gr.update();
}