Workflow Types
A Workflow Type (also called a Workflow Template, AxWorkflowTemplate) is the top-level AOT object that defines a complete workflow process. It specifies:
- The document being processed (the query definition via a workflow document class).
- The category (module grouping) the workflow belongs to.
- The supported elements — which approvals, tasks, automated tasks, and sub-workflows can be used in configurations based on this type.
- Event handlers for the overall workflow lifecycle (started, completed, cancelled).
- Submission and cancellation menu items.
- Line-item workflows for processing child records (e.g., purchase order lines within a purchase order header workflow).
- Association type — whether the workflow is scoped per company, global, or to another context.
When a functional administrator creates a workflow configuration in the D365 client, they select a workflow type as the template. The workflow editor then allows them to arrange the supported elements into a process flow.
Creating a Workflow Type
- In Visual Studio, create a new Workflow Type in your project.
- Set the
Categoryproperty to link it to a workflow category. - Set the
Documentproperty to your workflow document class. - Set the
SubmitToWorkflowMenuItem— the action menu item for submitting the document. - Add the supported elements (approvals, tasks, automated tasks) to
SupportedElements. - Set event handlers for
StartedEventHandler,CompletedEventHandler,CanceledEventHandler.
Supported Element References
The SupportedElements collection contains AxWorkflowElementReference objects. Each reference specifies:
ElementName— the AOT name of the workflow approval, task, or automated task.Type— the element type.
WorkflowElementType values:
| Value | Name | Description |
|---|---|---|
| 0 | Approval | A workflow approval element |
| 1 | Task | A workflow task element |
| 2 | SubWorkflow | A nested sub-workflow |
| 3 | AutomatedTask | A workflow automated task |
Line-Item Workflows
Workflow types can include line-item workflows (AxWorkflowLineItemWorkflow) to process child records within the parent document. For example, a purchase order header workflow might include a line-item workflow that independently routes each purchase order line through its own approval chain.
Line-item workflows specify:
LineItemWorkflowRelation— the table relation linking the parent document to the child records.- Their own event handlers (
StartedEventHandler,CompletedEventHandler,CanceledEventHandler). EnableLineItemWaitSelection— whether the workflow editor allows configuring wait conditions for line item completion.WorkflowTemplates— the workflow types that can be used for processing the line items.
Association Types
The AssociationType property controls the scope of the workflow:
| Value | Name | Description |
|---|---|---|
| 0 | Company | One workflow configuration per legal entity (company). |
| 1 | Global | A single workflow configuration shared across all legal entities. |
| 2 | Other | Custom scoping via the AssociationTypeRelation table relation. |
Most standard workflows use Company scope, meaning each legal entity configures its own workflow independently.
Extensions
Workflow types can be extended using Workflow Template Extensions (AxWorkflowTemplateExtension). Extensions allow adding supported elements and line-item workflows to an existing type.
What You Can Extend
| Extension Capability | Property | Description |
|---|---|---|
| Add supported elements | SupportedElements | Register new approvals, tasks, or automated tasks as available elements. |
| Add line-item workflows | LineItemWorkflows | Add new line-item workflow configurations. |
| Modify properties | PropertyModifications | Change property values on the base workflow type (e.g., update event handler references). |
What You Cannot Extend
- You cannot remove supported elements that exist in the base type.
- You cannot change the Document or Category properties via extension.
- You cannot remove line-item workflows defined in the base type.