Skip to main content

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

  1. In Visual Studio, create a new Workflow Type in your project.
  2. Set the Category property to link it to a workflow category.
  3. Set the Document property to your workflow document class.
  4. Set the SubmitToWorkflowMenuItem — the action menu item for submitting the document.
  5. Add the supported elements (approvals, tasks, automated tasks) to SupportedElements.
  6. 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:

ValueNameDescription
0ApprovalA workflow approval element
1TaskA workflow task element
2SubWorkflowA nested sub-workflow
3AutomatedTaskA 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:

ValueNameDescription
0CompanyOne workflow configuration per legal entity (company).
1GlobalA single workflow configuration shared across all legal entities.
2OtherCustom 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 CapabilityPropertyDescription
Add supported elementsSupportedElementsRegister new approvals, tasks, or automated tasks as available elements.
Add line-item workflowsLineItemWorkflowsAdd new line-item workflow configurations.
Modify propertiesPropertyModificationsChange 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.