Data trigger rule
Introduction
A data trigger rule determines whether a new workflow should be triggered when a data object is created, updated, or deleted. Learn more about data triggers here.
Rule syntax
Keywords
The following keywords are available in data trigger rules:
| Name | Type | Description |
|---|---|---|
| @do | DynamicDataObject | The data object that is triggering the workflow. Access attributes using the dot operator (e.g., @do.Status). |
| @event | DataChangeNotification | The change event that is triggering the workflow. |
| @changes | DynamicDataObject | The new or changed attribute values — the full new data on create, and the changed values on update. Populated on create and update events; null on delete. Access attributes using the dot operator (e.g., @changes.Status). |
| @diff | List | The list of attribute changes. Available only when Tracking Data Changes is enabled on the data trigger. Each item exposes FieldName, OldValue, and NewValue. On create events, every attribute is listed with OldValue as null. |
DataChangeNotification
| Name | Type | Description |
|---|---|---|
| IsCreated | bool | Whether the event is about creating a new data object. |
| IsUpdated | bool | Whether the event is about updating a data object. |
| IsDeleted | bool | Whether the event is about deleting a data object. |
| CaseId | Guid | The ID of the case in context. |
| WorkflowName | string | The name of the workflow that emitted the event. |
| ActivityName | string | The name of the workflow activity that emitted the event. |
| DataClass | string | The data class name. |
| DataObjectId | string | The ID of the data object in context. |
| Timestamp | DateTime | The time the event was emitted. |
| CorrelationId | string | The correlation ID for tracing the event across the system. |
Examples
Example 1: Integrate independent components
Trigger the "Sending Email" workflow when the status of an Email data object is updated to "ReadyForSend".
!@event.IsCreated && @changes != null && @changes.Status == "ReadyForSend"
Example 2: Auto-activate newly created objects
Trigger a workflow for every newly created data object (e.g., to set a default status).
@event.IsCreated
Example 3: React to specific field changes
Trigger a workflow only when a specific field has changed by inspecting the differential data.
#predicate
foreach (var change in @diff)
{
if (change.FieldName == "Priority" && change.NewValue == "High")
{
return true;
}
}
return false;