Write Patch to update Position Templates
Description
Environment
Activity
Marc Davis May 10, 2023 at 4:01 PM
Testing Successful. I did take a bit of a shortcut. Using the DBA tool, I ran the following query.
This output the values of the templates and from there I could search for the old custom fields.
Justin Kleinknecht May 9, 2023 at 7:28 PM
Note: An instance needs to be set up with a prod image before testing this application
Setup:
Navigate to Custom Field Definition view
Activate Building Code and Department Code Custom fields
Likely will show as "Building Code CF" and likewise for Department
Add a new Building or Department Code value to the custom field that does not exist as a Code entity
In the Core > Position view, create a new position
Set up some Building and Department Custom Field values
Save a template
Save various templates with various options until satisfied
Suggestions include a template with a building code and no department, and vice versa, as well as a template with the newly added code that does not exist as an entity
Return to the custom field definition and remove the newly added code that has been saved into a template
Apply image and run the patch
Testing:
Check each created template.
Building and Department Codes should migrate correctly
In the instance where the custom field value was set to a value that does not exist as a Code entity (i.e. the newly added value described above), the building/department code value should be empty
Check logs for any documented failures or issues
This should include the aforementioned value that doesn't exist as a Code entity
As part of USPSR-6350 we forgot to update Position Template records when updating building/department codes.
Write a patch to transfer values from the CFs to the proper Code references. Also remove the cf in cases where it contains invalid data.