Global Custom JS: Reuse JS Across Multiple Accounts

If you are a super user with multiple accounts, you can access “Global Custom JS” in your admin menu. This allows you to write Custom JS that runs for all all of the accounts in your organization.

Global JS has access to the DIGIOH_API (and the synonymous api) object, and is ideal for performing any setup or defining standard functions that will be reused across all of your accounts. This is the recommended approach versus copying and pasting Parent JS code across multiple Digioh accounts, just store whatever you want in the api object for use in Parent and Box JS.

  • All Global JS runs before Parent JS
  • The same Global JS runs for all accounts in your organization
  • Parent JS is account-specific

Otherwise, Global JS identical to Parent JS in its workflow. All code blocks with the exception of After Document Ready have access to the s object for box metadata, and submit code blocks have access to the x object.

One Caveat: after saving Global JS, publishing only publishes to the specific Digioh account where you are currently logged in. To publish “globally”, you need to go into each of your accounts and publish there. While this is an inconvenience, it is by design to avoid inadvertently publishing accounts that may be in an invalid state, if someone is current editing a box or JS, for example.

Tagged: