Skip to main content

Scripts Overview

Scripts define actions that can be triggered on objects. They can run automatically when an object is created or updated, or they can be triggered manually by the user.

Script types

Scripts fall into two categories:

  • Actor scripts — perform side effects on objects. Triggered via POST, run automatically on create/update, or invoked manually from the UI.
  • Producer scripts — return a list of results without modifying any object. Always invoked on demand via GET. See Sources for details.
TypeJSON valueCategoryDescription
JavaScriptjavascriptActor or ProducerRun a JavaScript function, inline or from a file.
StatementstatementActorDeclaratively create or update objects.
Consumer GatewayconsumerGatewayActorCall an external service (e.g. send an email).
Function GatewayfunctionGatewayActorCall an enrichment function and write the results back to the object.
Producer GatewayproducerGatewayProducerQuery an external source and return a list of results.

Common properties

All script types share these properties:

PropertyTypeDefaultDescription
namestringUnique identifier for this script within the class.
typestringOne of javascript, statement, consumerGateway, functionGateway, producerGateway.
scopeGENERAL | OBJECTOBJECT: applies to a specific class. GENERAL: not tied to a specific object.
triggerMANUAL | CREATE | UPDATE | string[]MANUALWhen the script runs. A single value or an array, e.g. "UPDATE" or ["CREATE", "UPDATE"].
parametersParameter[]Input values passed to the script.
preconditionsstring[]Formula expressions that must all evaluate to true before the script runs.
triggerValuesstring[]For UPDATE trigger: only run when a watched field changes to one of these values (e.g. a specific status).

Parameters

Parameters pass values into a script. Each parameter has a name and exactly one value source:

PropertyDescription
valueA literal value.
formulaA formula expression evaluated on the current object.
templateA Handlebars template string evaluated on the current object.
templateFilePath to a template file in the repository (without extension).
{
"name": "email",
"dataType": "EMAIL",
"formula": "emailAddress"
}
{
"name": "subject",
"dataType": "TEXT",
"value": "You have been invited"
}
{
"name": "message",
"dataType": "TEXT",
"templateFile": "templates/invitationMailText"
}

Preconditions

Preconditions are formula expressions. The script only runs if all preconditions evaluate to true. They are evaluated on the current object before the script executes.

{
"preconditions": ["emailAddress != null", "activeDate != null"]
}

Triggers

The trigger property accepts a single string or an array of strings:

"trigger": "UPDATE"
"trigger": ["CREATE", "UPDATE"]
ValueUI labelWhen it runs
MANUAL"Manual Action"The script appears as a button in the UI. The user clicks it to run it.
CREATERuns automatically when the object is first created.
UPDATERuns automatically every time the object is saved.
UI label mismatch

The UI displays manual scripts as "Manual Action", but the enum value in JSON is "MANUAL" — not "MANUAL_ACTION". Using "MANUAL_ACTION" is an invalid value and will cause the metadata endpoint to fail for the entire tenant (see warning below).

Invalid trigger values

An unrecognised trigger value causes a deserialization error when the platform loads the class definition. This failure affects the metadata endpoint for the entire tenant, not just the class containing the error. Always use one of the three documented values: MANUAL, CREATE, UPDATE.