Skip to content

Utility Scripts

Utility scripts are reusable JavaScript modules designed to share common logic between client scripts and server scripts.

They allow developers to centralize repeated code, simplify maintenance, and ensure consistent behavior across different execution environments.

Purpose

The main purpose of a utility script is to store logic needed in multiple scripts — for example, data formatting, field validation, calculations, or helper functions. Instead of duplicating these routines in both client and server scripts, they can be implemented once in a utility script and imported wherever needed.

SDK Access

When building Utility Scripts, we should keep in mind that the SDK differs between client and server.

For example, if we try to use server SDK in a client script, then it will throw an error because it does not understand functions like persistent, bizzStream

The only SDK modules accessible from a utility script are: - console — for logging messages and debugging output. - notification — for displaying user-facing messages such as warnings, errors, or confirmations.

Best Practices

  • Keep utility scripts pure — they should not depend on client-specific or server-specific APIs.
  • Focus on reusable logic such as validation, transformations, and shared constants.
  • Use clear naming conventions so it’s easy to identify what each utility provides.
  • When server-only functionality is needed, call it from the importing server script rather than placing it directly inside the utility.