Post install scripts

You can create post install scripts for an application. You can create up to three types of post install scripts:

  • Post Customer Create Script — A script that executes after customer creation when this application is part of initial list of applications. It will be executed in the order the applications are installed as part of customer creation. For example, if you want the new customer's first user to have a custom role instead of the default Administrator role, you can write a post install script for the Platform application that changes the first user's role to that custom role. See Creating a tenant with no administrative users for details.
  • Post App Install Script — A script that executes after the application is installed
  • Post App Update Script — A script that executes after the application is updated

To create a post install script for an application:

  1. Navigate to the setup page for the application.
  2. Click Post Install Scripts.

    Post Install Scripts

  3. Click Edit next to the type of script you want to create.
  4. Edit the script as desired.
    Note:

    If the post install script's purpose is to create a tenant with no administrator, you can access the automatically created user with the Administrator role and change the role to a custom role with some administrative permissions. For example:

    var objId = rbv_api.selectNumber
      ("SELECT id FROM USER where role =90"); // Administrator role's original ID is always 90
    var role = rbv_api.stringToJson(rbv_api.getRoleById("868114")); // Custom role with admin permissions
      rbv_api.setFieldValue("USER",objId,"role",role.code); // Set user's role to custom role
  5. Click Save.