For the complete documentation index, see llms.txt. This page is also available as Markdown.

Alert Scripts

Configuring Alert Scripts

Alert scripts allow you to implement custom business logic and complex conditional checks that go beyond standard webhook expression filters. This guide covers how to define and script an automated alert.


1. Script Information

Start by defining the identity and purpose of the alert:

  • Name: Provide a clear, recognizable name for the alert (e.g., "PNL Change by 20,000").

  • Code: A unique short-hand identifier for the script (e.g., "PNL").

  • Description: Briefly explain the logic or the specific scenario this script monitors (e.g., "A voyage PNL (result) has changed by more than 20,000").


2. Defining the Trigger

Specify which system events should initiate the execution of your script:

  • Object Type: Select the data entity to monitor (e.g., Voyage).

  • Event Type: Choose the action that triggers the script (e.g., Update).

Multiple triggers can be added to a single script by clicking the + icon in the Alert Script Trigger section. If the alert is scheduled, the triggers still apply: the script runs on the schedule and whenever a trigger fires.


3. Writing the Script Body

The Script Body is where the custom logic resides. Scripts must be written in the Groovy language.

  • Object Comparison: The script can access both the current state of the object (dlpObject) and the previous state (oldDlpObject) to compare changes.

    {% hint style="warning" %} A script that contains the text oldDlpObject anywhere, including in a comment, cannot be scheduled. Use separate scripts for alerts that compare changes and alerts that run on a schedule. {% endhint %}

  • Scheduled runs: There is no triggering object, so dlpObject and oldDlpObject are not available. Query the data the alert should check instead, see Script Body Guide.

  • Return Values: Always return a boolean (true or false). Ensure the script returns false if the conditions for an alert are not met to prevent unnecessary notifications.

See Script Body Guide for more in-depth information.

See full script examples in the Alert Scripts API documentation.


4. Message Configuration

Once the script logic determines an alert should be sent, configure the output:

  • Message Subject: Define the subject line for the resulting notification (e.g., [VMS] Voyage PNL Alert).

  • Message Type: Select the format of the output (e.g., String, XML, JSON).

  • Build message in script: Check this box if the actual content of the alert notification is generated dynamically within the logic written in the Script Body.

    • If unchecked, you can provide an "Alert Script Message" string.

    • Scheduled alerts have no default message, so always provide one of these.


Tips for Success

Was this helpful?