Fix Script - Populate new field on historic records

Kiera Mears
Mega Guru

Hi,

We have a custom application and have added a new field to populate with a value based on the category and subcategory (for where the work can be completed). E.g. if Category is X and Subcategory is Y, then work location is C.

We have this set up for any new records using a matrix, but need to run a fix script on historic records.

Any suggestions? Coding isn't my strongest area!

Thanks,

Kiera

1 ACCEPTED SOLUTION

Kiera Mears
Mega Guru

I resolved this myself, I copied the business rule that was being used into a fix script and amended it slightly to function as required. Mainly ensuring it's looking at the correct tables and changing 'current' to the relevant variable name, and added an 'if empty' condition so it wouldn't have to repeatedly go through the same 40,000 records.

Thanks all for your inputs!

View solution in original post

8 REPLIES 8

Ravi9
ServiceNow Employee
ServiceNow Employee

it will depend on the way ur "matrix" table is set up though , can you share some details of that ? 

It was set up by our 3rd party... But in simple terms, this is how it works. It pulls the Category and Subcategory from the record and tells it what the location should be based on that criteria.

find_real_file.png

 

There's then a business rule that says when category or subcategory change, update the work location field with this information.

Does that help?

Ravi9
ServiceNow Employee
ServiceNow Employee

your location doesnt seem to be a valid reference to cmn location ! how does your target form look like ? is the location a reference there ? 

Kiera Mears
Mega Guru

I resolved this myself, I copied the business rule that was being used into a fix script and amended it slightly to function as required. Mainly ensuring it's looking at the correct tables and changing 'current' to the relevant variable name, and added an 'if empty' condition so it wouldn't have to repeatedly go through the same 40,000 records.

Thanks all for your inputs!