Workflow is defined as the movement of documents or tasks through a work process. In Microsoft Dynamics AX, the focus of workflow is on approval and task-oriented workflows. The developer role in Microsoft Dynamics AX is primarily to add workflow to existing business documents or create new documents that support workflow. This topic describes what the workflow life cycle is and the developer role for a workflow in Microsoft Dynamics AX.
Workflow can be described as structured or unstructured. In Microsoft Dynamics AX, workflow is structured and based on user interaction and system automation of business data. For example, when a purchase requisition (business data) is created it, workflow can be used to verify and approve the data.
Workflow Lifecycle
All workflows follow a basic life cycle as shown in the following illustration.
You design the workflow based on customer requirements. The company administrator configures the workflow, and users run the workflow. This section describes the some of the main development concepts used in the design section of the workflow life cycle in Microsoft Dynamics AX.
Workflow types
The workflow type is a building block that can be used to create customized workflows that enforce business policies. The workflow type is defined in the Application Object Tree (AOT) at design time. The metadata from the workflow type is used by the customer to create a workflow configuration.
Workflow configurations
Workflow configurations are created by application administrators that use the Microsoft Dynamics AX workflow editor. The administrator configures the workflow, workflow elements, and approval steps that control the flow of the business document though the workflow process.
Workflow instances
A workflow instance is created by the workflow runtime when a workflow is activated.
Workflow elements
The elements of a workflow are created by you in the AOT and configured by application administrators. The workflow structure consists of sequences of workflow elements. An element can be a task, automated task, approval, or a sub-workflow.
Approvals are specialized workflow elements that allow for sequencing of multiple steps, which use a fixed set of outcomes. Tasks are generic workflow elements that represent a single unit of work which use custom outcomes defined by the developer. Automated tasks are workflow elements used to invoke X++ code within the application without requiring human intervention.
Work items
Work items are the units of work created by the workflow at runtime. They are the main interface between the end user who participates in a workflow and the workflow runtime. All work items for users who are logged on are surfaced in the Unified Work List and are used to inform a user about work assignments.
Developer Role
You must create the workflow artifacts, dependent workflow artifacts, and business logic to support the workflow. The following sections describe most of the developer artifacts used in a Microsoft Dynamics AX workflow.
Workflow Artifacts
-
Workflow type
-
Define the workflow document.
-
Define event handlers for workflow Started, Completed, ConfigDataChanged, and Canceled.
-
Define menu items used for the workflow type like Submit.
-
Define the workflow category.
-
Define required approvals, tasks, and automated tasks.
-
Enable and disable activation conditions.
-
Workflow category
-
Approval
-
Define the approval workflow document.
-
Define approval event handlers for Started and Canceled.
-
Define approval menu items such as Document, Resubmit, and Delegate.
-
Enable or disable fixed approval outcomes.
-
Define approval outcome menu items for Action and ActionWeb.
-
Define approval outcome event handler.
-
Define the DocumentPreviewFieldGroup.
-
Task
-
Define the task workflow document.
-
Define task event handlers for Started and Canceled.
-
Define task menu items for Document, DocumentWeb, Resubmit, ResubmitWeb, Delegate, and DelegateWeb.
-
Enable or disable task outcomes.
-
Define task outcome menu items for Action and ActionWeb.
-
Define task outcome event handler.
-
Define the DocumentPreviewFieldGroup.
-
Automated Task
Dependent Workflow Artifacts
The following workflow artifacts are dependent upon the type of workflow defined in the AOT.
-
Workflow Document class - identifies the document query and any calculated fields.
-
SubmitToWorkflow class - displays the Submit to Workflow dialog box in the user interface, receives user comments, activates the workflow, and can update workflow state.
-
State model - tracks the state of the document in the workflow process, for example, Submitted, ChangeRequested, or Approved.
-
Event handlers for the workflow itself on the workflow type, approval, approval outcomes, automated task, task, and task outcomes.
-
Action and display menu items as well as classes which determine the action taken when a menu item is selected in the user interface.
-
Custom workflow providers.
-
canSubmitToWorkflow method - required on each table enabled for workflow.