Workflow Triggers
Triggers are the starting point of any workflow. They define when and how a workflow should be executed. This document covers the different types of triggers available in our system and how to configure them using YAML.
Types of Triggers
There are three main types of triggers:
- Entity Triggers
- Manual Triggers
- Scheduled Triggers
Entity Triggers
Entity triggers are used to execute workflows based on changes to specific entities in the system.
triggers:
- type: "Entity"
entityName: "Order"
eventType: "Modified"
position: "After"
conditions:
- expression: "[Order.Status] = 'Ready for Pickup'"
Configuration Options
type
: Optional. Default is "Entity".entityName
: Required. The name of the entity to watch (e.g., "Order", "Shipment").eventType
: Required. Can be "Added", "Modified", or "Deleted".position
: Optional. Can be "Before" or "After" database persistence. Default is "After".conditions
: Optional. C# expressions to further filter when the trigger should fire.
Available Variables
For "Modified" events, a changes
variable is available:
{
"field1": { "originalValue": "oldValue", "currentValue": "newValue" },
"field2": { "originalValue": "oldValue", "currentValue": "newValue" }
}
Example: Trigger on New High-Priority Order
triggers:
- type: "Entity"
entityName: "Order"
eventType: "Added"
position: "After"
conditions:
- expression: "[Order.Priority] = 'High'"
Manual Triggers
Manual triggers allow users to start workflows directly from the user interface.
triggers:
- type: "Manual"
displayName: "Process Rush Order"
additionalProperties:
silent: true
Configuration Options
type
: Set to "Manual".displayName
: Optional. The text shown on the trigger button in the UI.additionalProperties
: Optional. Can includesilent: true
to suppress notifications.
Example: Manual Trigger for Inventory Audit
triggers:
- type: "Manual"
displayName: "Start Inventory Audit"
additionalProperties:
requireConfirmation: true
Scheduled Triggers
Scheduled triggers execute workflows at specified intervals using cron expressions.
schedules:
- cron: "0 0 * * 1"
displayName: "Weekly Report Generation"
Configuration Options
cron
: Required. A cron expression defining the schedule.displayName
: Optional. A human-readable name for the schedule.
Common Cron Patterns
- Every Monday at midnight:
0 0 * * 1
- Every 5 minutes:
*/5 * * * *
- First day of every month at midnight:
0 0 1 * *
Example: Daily Shipment Summary
schedules:
- cron: "0 18 * * 1-5"
displayName: "Daily Shipment Summary (Weekdays at 6 PM)"
Best Practices
- Use meaningful names for your triggers, especially for manual and scheduled triggers.
- Keep conditions simple and focused. Complex conditions are better handled within the workflow logic.
- For entity triggers, prefer "After" position unless you need to intervene before the database is updated.
- Use scheduled triggers sparingly to avoid overloading the system.
- Test your triggers thoroughly, especially when using complex cron expressions.
For more advanced cron expressions, use tools like CronTabGuru to ensure accuracy.