Data trigger rule
Introduction
Data trigger rule is used to determine whether a new workflow should be triggered when a data object is created, updated, or deleted. You can learn more about data trigger here.
Rule syntax
Keywords
You can use the following keywords to work with data trigger rules:
| Name | Type | Description |
|---|---|---|
| @do | DynamicDataObject | The data object in context, which is triggering the workflow. You can access the attributes using the "dot" operator. |
| @event | DataChangeNotification | The change event in context, which is triggering the workflow. |
| @changes | DynamicDataObject | The changed values. This keyword is valid for update events only. You can access the attributes using the "dot" operator. |
A DataChangeNotification object has the following properties:
| Name | Type | Description |
|---|---|---|
| IsCreated | bool | Determine whether the event is about creating a new data object or not. |
| IsDeleted | bool | Determine whether the event is about deleting a data object or not. |
| CaseId | string | Id of the case in context. |
| WorkflowName | string | Name of the workflow emitted the event. |
| ActivityName | string | Name of the workflow activity emitted the event. |
| DataClass | string | Data class name. |
| DataObjectId | string | Id of the data object in context. |
| Timestamp | DateTime | The time the event is emitted. |
Examples
Example 1: Integrate independent components
Applications can trigger the 'Sending Email' workflow independently of the Email Component by simply updating the status of the Email object.
!@event.IsCreated && @changes != null && @changes.Status != "ReadyForSend"
Example 2: Avoid duplication
If we have logic like this “All objects created must be activated by default”, in many cases, it’s a good idea to use a data trigger to avoid repeating the logic every time we create a new object.
@event.IsCreated