Mass reopening closed Vulnerable Item records

sarahjantz
Tera Expert

We have about 5,000 vulnerable items that were assigned to the incorrect group before being closed. We'd like to reopen these and reapply the assignment rules so they can be properly documented with the correct assignment but ServiceNow has said there is no out of box way to mass reopen these records. Does anybody have any creative ideas of how to accomplish this?

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

I think you can use a Fix Script to Reopen Vulnerable items.

So you can write a script to query the vulnerable item table and then add addEncodedQuery to query those 5000 items and then update them with active = true and state = open

 

Example

 

var vul = new GlideRecord('sn_vul_vulnerable_item');
vul.addEncodedQuery('<Your query>');
vul.setLimit('5000');
vul.query();

while (vul.next())
{
        vul.state = <state for open>;
	vul.substate = <substate if any>;
        vul.work_notes = <Reason for Reopening>;
	vul.update();
}

 


Please mark this response as correct or helpful if it assisted you with your question.

Martin Dewit
Kilo Sage

Without scripting, you can also utilize the Bulk Edit feature on VIT lists. This would allow you to set state to Open (1,000 at a time). Note, it does reset the remediation target/status if using Last Opened as your configured target from. In that case scripting may be the better option since you can set those fields in the script. I would suggest testing Bulk Edit and/or a fix script in a sub-prod instance prior to production.

 

I would make sure to update the assignment rules that were used on the 5,000 records prior to reapply so that they can be properly assigned this go around.

Thank you. We did try the bulk edit option, but it would not update any of the values of the closed records. 

Shivam Sarawagi
ServiceNow Employee
ServiceNow Employee

Bulk edit won't update the closed items. Ideally! we would need to do that via script that you can put as fix script

 

var vit = new GlideRecord('sn_vul_vulnerable_item');
vit.addEncodedQuery('Encoded query');
vit.setLimit(5000);
vit.query();
while (vit.next()) {
vit.state = 1;
vit.substate = "";
vit.update();
}

 

If the assignment type for these items was the rule (not manual), automatically, "Transit to Open" would trigger the reapply of the assignment rules on these 5000 VITs.