Notice: Fix Scripts – Scoped Applications and Upgrades (Quebec onwards)
Summary
With the release of Quebec, ServiceNow have removed 3 fields from the fix script table (Active, Run Once, Flush Cache).
As a result (unsure if it’s a direct relationship to the removal of these fields), all fix scripts associated to the application scope are run after an install or upgrade of the scoped application.
This can cause unexpected and undesired effects for developers who have created a fix script with the intention to solve a specific scenario under the right circumstances and only to be run under those.
This means now the mentality of creating fix scripts in scoped applications that will be deployed need to assume they ALL run pre/post install or upgrade.
Side Effect
All fix scripts for the scoped application get run by default (post upgrade), or pre-upgrade if the ‘before’ field is ticked on the fix script.
For some, these changes may not make much of a difference but those who have in the past have created fix scripts with the intention to only be run for specific reasons or conditions (after review) it can be now harmful to upgrade the scoped application without some kind of intervention.
Example Scenario
- Company XYZ 4 years ago created several fix scripts for a scoped application only to run if required post Go-Live depending on the customer wanting to enable a feature or not.
- The fix scripts were marked as inactive and only to be run by the admin if needed as this could have undesired effects if ran without the correct scenario
- Company XYZ then upgrades to Quebec/Rome
- Company XYZ goes through the regular development cycle and finally upgrades the scoped application to the latest version
- The legacy fix scripts from 4 years ago which are no longer relevant all kick off post upgrade of the scoped application
I am interested in hearing how you may want to tackle this moving forward as I feel the severity of this issue is not yet apparent enough and now is about the time companies are moving to Quebec/Rome and will be soon upgrading their various scoped applications unknowing of this behaviour.
Official ServiceNow Documentation on Fix Scripts:
A fix script is server-side JavaScript code that you run after an application is installed or upgraded.
Include fix scripts to make changes that are necessary for the data integrity or product stability of an application.
Review the code design to ensure that it can run more than once on the same system without causing damage. For example, you may write a fix script that adds a role to a property by default. Design the script so that it can run multiple times on the same system without overwriting the existing data, even if it is not necessary to run the script again after the initial installation.
https://www.servicenow.com/community/now-platform-articles/notice-fix-scripts-scoped-applications-and-upgrades-quebec/ta-p/2307667