Workflow Automated Tasks
A Workflow Automated Task (AxWorkflowAutomatedTask) defines a processing step that executes X++ code without human intervention. When the workflow reaches an automated task, the framework invokes the configured ExecutionEventHandler class. The code runs, performs its business logic, and the workflow advances automatically.
Automated tasks are used for:
- Auto-posting invoices or journals after approval.
- Sending notifications or generating documents at a specific workflow stage.
- Updating status fields or setting flags on the record.
- Triggering integrations with external systems.
- Data validation or enrichment steps before human review.
Execution Flow
- The workflow reaches the automated task step.
- The framework invokes the
ExecutionEventHandlerclass. - The handler class performs its logic using the
WorkflowContextto identify the record. - If the execution succeeds, the workflow advances to the next step.
- If the execution fails (throws an exception), the workflow enters an error state for administrator review.
Creating an Automated Task
- In Visual Studio, add a new Workflow Automated Task to your project.
- Set the
Documentproperty to the workflow document class. - Set the
ExecutionEventHandlerto your handler class. - Optionally set
CanceledEventHandlerfor cancellation handling. - Register the automated task as a supported element in a workflow type.
warning
Automated task event handlers run in the batch framework context. Ensure your code is stateless, handles exceptions gracefully, and does not rely on interactive user sessions (e.g., no Box:: dialogs or form interactions).