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.
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.Return Values: Always return a boolean (
trueorfalse). Ensure the script returnsfalseif the conditions for an alert are not met to prevent unnecessary notifications.
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.
Tips for Success
Include type checks (e.g., if (dlpObject instanceof Voyage)) at the beginning of your script to prevent execution errors when data is missing.
Last updated
Was this helpful?