1. Windows Workflow Foundation
There is a relationship between the workflow
infrastructure in Dynamics AX 2009 and Windows Workflow Foundation,
which is part of the .NET Framework 3.5. Windows Workflow Foundation
provides many fundamental capabilities that are used by the workflow
infrastructure in Dynamics AX 2009. As a low-level infrastructure
component, however, Windows Workflow Foundation has no direct awareness
of or integration with Dynamics AX 2009. In Figure 1,
the workflow infrastructure (labeled A) is an abstraction layer that
sits above Windows Workflow Foundation (labeled B) and allows workflows
that are specific to Dynamics AX to be designed, implemented, and
configured in Dynamics AX 2009 and then executed by using Windows
Workflow Foundation.
In the following list, each numbered item refers to the corresponding part of Figure 9-2.
The developer designs and implements workflow elements and business logic in the Application Object Tree (AOT).
The business user configures workflows in the Dynamics AX 2009 client.
The
workflow runtime bridges both the Dynamics AX 2009 workflow
infrastructure and Windows Workflow Foundation; it instantiates and then
executes workflow configurations. (The administrator manages the
runtime environments.)
Users interact with workflow user interface controls both in the Dynamics AX 2009 client and in Enterprise Portal.
2. Automating Business Processes
You can use the Dynamics AX 2009
workflow infrastructure to automate aspects of a business process that
are part of a larger business process automation effort. There is no
single, correct approach to this undertaking, but at a high level, you
can follow the steps listed here to figure out and understand your
existing business processes, then to determine how these business
processes should function, and finally to automate them by using
workflow.
1. | Map out existing business processes. This effort is often referred to as developing the as-is model.
|
2. | Analyze
the as-is model to determine whether obvious improvements can be made
to existing processes; these improvements are represented in another
business process model, which is often referred to as the to-be model.
|
3. | Design
the way in which you’re going to implement the to-be business process
model—or the changes to the as-is model suggested by the to-be model. In
this step, you might decide which parts of the to-be business process
need to be automated with workflow and which parts should remain manual.
|
4. | For
the parts of the business process model in which workflow is going to
be used—and for the parts you want to automate—define the workflow
document and design one or more workflows. This step centers on the
workflow document that the workflow will act over.
|
5. | The developer implements the workflows.
|
6. | The
business user configures and enables the workflows, causing workflow
instances to be created when a record for the workflow document is
submitted.
|
The major advantage of the workflow
infrastructure in Dynamics AX 2009 is that it provides a significant
amount of functionality out of the box, meaning that custom workflows
don’t have to be written. Businesses and organizations will have more
time to focus on improving their
processes instead of writing and rewriting business logic. Additionally,
the Dynamics AX 2009 workflow is continually being enhanced in response
to feedback from customers, partners, and ISVs to provide even more
value in subsequent releases, making the investment in workflow
increasingly valuable over time.
Workflow from a Developer’s Perspective
From your perspective as a Dynamics AX
developer, workflow is something that you work with to help the users in
your business or organization in their efforts to improve efficiency.
The ultimate goal for workflow in Dynamics AX 2009 is to make it as easy
as possible for business users to fully configure workflows themselves,
freeing developers to work on other activities. Currently, developers
and business users work together to create and customize workflows,
which consumes time and resources for both parties.
Key Workflow Concepts
As a Dynamics AX developer, you need to
understand a number of key concepts to successfully help business users
implement workflows.
Workflow Document and Workflow Document Class
The
workflow document, sometimes referred to as the Business Document, is
the focal point for workflows in Dynamics AX 2009. Every workflow
template and every workflow element must reference a workflow document
because it provides the data context for the workflow. A workflow
document is an AOT query supplemented by a class in the AOT (referred to
as the workflow
document class). The term workflow document is used instead of query
because it more accurately portrays what the workflow is operating on. A
query can reference multiple data sources and isn’t constrained to a
single table. In fact, a query can reference data sources
hierarchically. However, if there are multiple data sources within a
query, the first data source is considered the primary or root one.
Note
The workflow document and workflow document class are located in the AOT in the Dynamics AX 2009 client. |
Workflow in Dynamics AX 2009 incorporates the
use of an expression builder to enable conditions to be defined that
control the behavior of an executing workflow. The expression builder
uses the workflow document to enumerate all the fields that can be
referenced in conditions. Calculated fields are not supported on queries
in Dynamics AX 2009. Therefore, to make derived data available within
conditions, you add parm
methods to the workflow document class, into which X++ code can be
introduced to produce the derived data. The workflow document then
returns the fields from the underlying query plus the data generated by
the parm methods.
Note
Referencing
a workflow document from the workflow template and elements might be
standardized in the future if it becomes possible to obtain derived data
from the underlying query itself. |
Workflow Categories
Workflow categories determine whether a
workflow template is associated to a specific module. (Without these
categories, you could see all workflows in the context of every module
in Dynamics AX 2009.) For example, a workflow category named ExpenseManagement,
which is mapped to the Expense Management module, comes with Dynamics
AX 2009. All workflows associated to this module are visible in the
Dynamics AX 2009 client within the Expense Management module. If you add
a new module to Dynamics AX 2009, you must create a new module and then
a new workflow category that references that module.
Note
The workflow categories are located in the AOT in the Dynamics AX 2009 client. |
Workflow Templates
The
workflow template is the primary building block used to create
workflows. The developer defines the workflow template in
AOT\Workflow\Workflow Templates. Defining the workflow template involves
setting the various properties (including workflow document and
workflow category). The business user later references this workflow
template when creating a workflow configuration.
Note
The workflow templates are located in the AOT in the Dynamics AX 2009 client. |
Event Handlers
Event handlers are well-defined integration
points that enable you to execute application-specific business logic
during workflow execution. Workflow events are exposed at the workflow
level and the workflow element level. For more information about event
handlers, including where they are used, see http://msdn.microsoft.com/en-us/library/cc588240.aspx.
Note
The event handlers are located in the AOT in the Dynamics AX 2009 client. |
Menu Items
Workflow in Dynamics AX 2009 uses both display
and action menu items. Display menu items are used to navigate to either
a form in the Dynamics AX 2009 client or to a Web page in Enterprise
Portal that displays the details of the record being processed by
workflow. Action menu items are used for each possible action a user can
take in relation to a workflow. They also provide another integration
point for developers to integrate custom code. For more information
about the menu items that are used in the workflow infrastructure, see http://msdn.microsoft.com/en-us/library/cc602158.aspx and http://msdn.microsoft.com/en-us/library/cc604521.aspx.
Note
The menu items are located in the AOT in the Dynamics AX 2009 client. |
Workflow Elements
The elements of a workflow represent the
activities that can be configured within a workflow. The business user
configures these elements; the developer creates them. An element can be
a task, an approval, or a subworkflow.
Approvals are specialized tasks that allow sequencing of multiple steps and use a fixed set of outcomes.
Tasks
are generic workflow elements that represent a single unit of work. The
developer defines the possible outcomes for each task.
Subworkflows are workflows that are invoked from other workflows.
The workflow structure is made up of sequences of workflow elements.
Note
The workflow elements are located in the AOT in the Dynamics AX 2009 client. |
Providers
Workflow in Dynamics AX 2009 uses the provider
model as a flexible way of allowing application-specific code to be
invoked for different purposes when a workflow is executing. There are
three providers in workflow: due date, participant, and hierarchy. For
more information about workflow providers, including where they are
used, see http://msdn.microsoft.com/en-us/library/cc519521.aspx.
Note
The providers are located in the AOT in the Dynamics AX 2009 client. |
Workflow Configurations
The business user creates the workflow
configurations using the workflow configurations form in the Dynamics AX
2009 client. The business user first selects a workflow template and
then configures the approvals and tasks that control the flow of
activities through the workflow.
Note
The workflow configurations are located in the Dynamics AX 2009 client – workflow configurations form. |
Workflow Instances
A workflow instance is an activated workflow
created by combining the workflow configuration and the underlying AOT
workflow elements on which the workflow configuration is based (the
workflow template, tasks, and approvals).
Note
The workflow instances are located in the Dynamics AX 2009 workflow runtime. |
Work Items
Work
items are the actionable units of work that are created by the workflow
instance at run time. When a user interacts with workflow, he or she is
responding to a work item that has been generated from a task or
approval element. Work items are surfaced in the Dynamics Unified
Worklist Web part and in the Dynamics AX 2009 client.
Note
The workflow items are located in Dynamics AX 2009 workflow runtime, Enterprise Portal, and the Dynamics AX 2009 client. |