Why fix script runs every time I install the plugin

xuchangchen
ServiceNow Employee
ServiceNow Employee

Hi, all

I have a fix script in the scoped plugin, usually fix script runs when we upgrade from lower version to a higher version and it always work like this.

However, this time the fix script I have runs every time after I zbooted and install the plugin, is this an expected behavior? If so, do we have a way to prevent this?

Here is the setting of my fix script:

active: true

before: false

flush_cache: false

run_once: true

unloadable: false

Thanks

5 REPLIES 5

xuchangchen
ServiceNow Employee
ServiceNow Employee

How do I run a fix script only when upgrade?


The SN Nerd
Giga Sage
Giga Sage

The documentation is as follows:


Run onceSelect the check box to run the script only one time (default). The fix script is ignored for subsequent upgrades.

Clear the check box allow the script to run every time the application is installed or upgraded.


This option is enforced by the following mechanism.
  • When a fix script is processed, a corresponding record is added to the sys_update table.
  • The upgrade process automatically skips fix scripts that are flagged as Run once and have an entry in the sys_update table.

Run once is not enforced when you test the fix script.


Fix scripts



Does this contradict your experience?



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

So even when I mark run_once to be true, the fix script will still run when I install the plugin, say I only want to run this fix script when I upgrade, but not when I install, is there a way? thanks!


You would need to clear the 'run once' checkbox but add a precondition to determine if the plugin is installed for the first time and not run in that scenario.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022