Skip to main content

Event Trigger

The event trigger starts a workflow by itself when a row in a Vince Platform table is added, changed or deleted. You can also add a condition, so the workflow starts only for the changes you care about, for example only when an order gets the status "Released". Use it to react to data changes without anyone clicking Run and without checking the table on a timer.

When a row in the chosen table is added, changed or deleted, the event trigger checks whether the action matches, then checks the condition. If the condition is true, the workflow starts once for that row; if it is false, nothing happens.


Set it up​

  1. Open the Trigger step and choose the event trigger.
  2. Choose the Table to listen to.
  3. Choose the Actions that start the workflow: Create (a row is added), Update (a row is changed), Delete (a row is removed). You can select one or several.
  4. Optionally, add a condition so the workflow starts only for some changes. Write it as an Expression, or use the simpler Filter form.
  5. Save the workflow.

We recommend an Expression over the Filter form: it can do everything the form can and more, such as comparing old and new values or checking several properties, and it is easy to copy and review. Expressions use JSONata, and the event is reached through data., for example:

data.changed.status.newVal = 'RELEASED'

This is true when the status of a row has just changed to RELEASED. If the condition is true, the workflow starts; if not, nothing happens.


Example​

Send a message to the warehouse when a purchase order is released.

SettingValue
Tablepurchase-orders
ActionsUpdate
Expressiondata.changed.status.newVal = 'RELEASED'

Someone changes order PO-10482 from DRAFT to RELEASED. The workflow starts and receives the event as its body:

{
"data": {
"changed": {
"status": { "newVal": "RELEASED", "oldVal": "DRAFT" }
},
"newData": { "orderNumber": "PO-10482", "status": "RELEASED" },
"oldData": { "orderNumber": "PO-10482", "status": "DRAFT" }
}
}

The row is shown shortened here; newData and oldData hold every property of the row. In a later step, such as a Transform, read the new status with $context.data.trigger.body.data.newData.status.


What the workflow receives​

The workflow receives the whole event as its body, not just the row:

PathContains
body.data.newDataThe full row after the change
body.data.oldDataThe full row before the change
body.data.changed.<property>For each property that changed, its newVal and oldVal

On Create, oldData is empty. On Delete, newData is empty, so read the deleted row from oldData.

For the full event shape, nested objects and lists, and expressions that fire at the right moment, see Triggers in Depth.


Tips and limits​

  • The event trigger fires once per matching row. If several rows change at the same time, the workflow runs once for each of them.
  • Typical uses: send an email when an order is created, update M3 when a row is changed, archive data to the Data Lake when rows are deleted.

  • Triggers in Depth: the event shape, expressions and patterns, in depth
  • Trigger: the other ways to start a workflow
  • Table: create and manage the tables that event triggers respond to