Reapply Assignment Rules on manually reassigned VIT's

14Hernan
Tera Contributor

We have various VIT's (in the thousands) that were manually reassigned therefore the newly created assignment rules don't apply to them. However, we would like to know if there is a solution we can implement to get the assignment rules to apply, even if a VIT was manually reassigned.

 

Is the fix as simple as changing the value type to Assignment Rule? What are the implications of doing so?

If it's not recommended to change the value, what are some solutions we can implement?

 

The end goal is to have the VIT's automatically reassigned by assignment rules and avoid having to use the bulk edit feature, as that would require evaluating VIT's manually. 

1 ACCEPTED SOLUTION

jcmings
Mega Sage

I'm not familiar with the Vulnerability Response stuff, but I don't see why you can't do this with a fix script. First, filter your list to the records you'd like to update (as you would if you were doing bulk edit). Copy that query; you'll use it for an encoded query. Your fix script would look something like...

var gr = new GlideRecord('table'); //update to relevant table
gr.addEncodedQuery('query'); //use query from the list you filtered on
gr.query();
while (gr.next()) {
gr.assignment_group = ''; //new assignment group
gr.work_notes = 'Assignment group updated via Fix Script NAME'; //just for tracking purposes
gr.update();
}

 

I'd recommend testing this on 1-2 records before applying to the entire encoded query list.

View solution in original post

2 REPLIES 2

jcmings
Mega Sage

I'm not familiar with the Vulnerability Response stuff, but I don't see why you can't do this with a fix script. First, filter your list to the records you'd like to update (as you would if you were doing bulk edit). Copy that query; you'll use it for an encoded query. Your fix script would look something like...

var gr = new GlideRecord('table'); //update to relevant table
gr.addEncodedQuery('query'); //use query from the list you filtered on
gr.query();
while (gr.next()) {
gr.assignment_group = ''; //new assignment group
gr.work_notes = 'Assignment group updated via Fix Script NAME'; //just for tracking purposes
gr.update();
}

 

I'd recommend testing this on 1-2 records before applying to the entire encoded query list.

cp11
ServiceNow Employee
ServiceNow Employee

A question I have is, it was manually assigned and then you would like to run the rules - is it because the manual assignment is wrong? It is intentionally set that way OOB to prevent assignment rules overwriting manual assignment. Assignment rules should take care of the future VITs coming in. 

Having said that, you should be able to change the assignment type to rule via script and then run the assignment rules, either via script or by re-evaluating. 

As usual test it on a small sample set, and then make sure you can manually assign as well reapply rules, just to make sure.