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.

Administrators and users with the script_fix_admin role can create and run fix scripts.

Create a fix script

Create fix scripts to ensure the system installs or updates an application properly.

About this task

Use fix scripts to add, update, and delete data, including rules, scripts, and property settings.

Procedure

  1. Navigate to System Definition > Fix Scripts.
  2. Click New.
  3. Define the fix script by completing the fields on the form.
    Field Description
    Name Enter a unique, descriptive name for the fix script.
    Active Select the check box to enable the fix script.
    Unloadable Select the check box to create Customer Update [sys_update_xml] records when the fix script runs. Clear the check box to run upgrades without creating these records (default).

    Unloadable is enforced when you test the fix script.

    Run once Select 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.

    Flush cache Select the check box to require a cache flush after the application is installed or upgraded. Certain system changes—such as changes to the dictionary, client scripts, UI policy, or system properties—require a cache flush to take effect.

    If the check box is selected for at least one of the fix scripts that are run, the cache is flushed when the installation or upgrade is complete. If the check box is not selected for any of the fix scripts that are run, then the cache is not flushed.

    Flush cache is enforced when you test the fix script.

    Before Select the check box to run the fix script before installing or upgrading the application. Clear the check box to run the fix script after (default).
    Description Enter a description of the fix script.
    Script Enter the code for the fix script.
  4. Click Submit.
  5. Test the fix script and make any necessary changes.

Test a fix script

Test your fix scripts to ensure they install or update applications as expected.

About this task

Fix scripts add, update, and delete data, including rules, scripts, and property settings.

Note: Do not test fix scripts on production instances.

Procedure

  1. Open the fix script record.
  2. Review the code design to ensure that it can run more than once on the same system without causing damage.
    This review is different from the Run once option, which determines whether it is necessary to run it more than once on the system. 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.
  3. Click the Run Fix Script related link.
    The Run once option is not enforced for tests, however the Flush cache and Unloadable options are enforced.
  4. Confirm how to run the script.
    OptionDescription
    Proceed in Background Use this option for long-running scripts, or if you do not know the expected execution time.
    Proceed Use this option to run the script immediately and display the results in a confirmation window.
    Successful fix script test
  5. Review the results from the Progress Workers related list, and make any necessary changes. To manually stop a running fix script:
    1. From the Progress Workers related list, select a worker in the Running state.
    2. Select the Cancel job related link.
    Progress Workers results

Run fix scripts

After you transfer an application to another instance, you must manually run any necessary fix scripts.

About this task

To run a fix script:

Procedure

  1. Navigate to System Definition > Fix Scripts.
  2. Edit the filter to search for your application name. For example, Application | is | Book Rooms).
  3. Open the fix script record.
  4. Click Run Fix Script.