Logo
CAR REVIEW
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

Workflow in Dynamics AX 2009 : Workflow Life Cycle (part 2) - Creating the Workflow Document Class

5/14/2013 5:57:45 PM
1.3 Creating the Workflow Document Class

The purpose of a workflow is to automate all or part of a business process. To do this, it must be possible to define various rules over the document that is being processed by workflow. In Dynamics AX 2009, these rules are referred to as conditions. A business user creates conditions in workflow when configuring the workflow. Conditions can be used, for example, to decide whether a purchase requisition should be approved automatically (without any human intervention). Figure 4 shows a simple condition defined in the workflow configuration form.

Figure 4. A simple condition defined in the workflow configuration form

When a business user is configuring a condition by using the workflow configuration form, he or she needs to make sure the users have a way to select the fields from the workflow documents they want to use. On the surface, this configuration seems simple, but two requirements complicate the task. First, the user must be able to filter the available fields because not all the fields in a table might make sense to the business user. Second, it must be possible to use calculated fields (also referred to as derived data). The workflow document class meets these two requirements by functioning as a thin wrapper around an AOT query that defines the available fields and by providing a mechanism for defining calculated fields.

The AOT query enables developers to define a subset of fields from one or more related tables. By adding nested data sources in a query, you can model quite complex data structures, but most commonly the nested query is used to model a header-line pattern. At design time, when the business user is configuring a workflow, the AOT query is simply used by the condition editor to figure out which fields to display to the business user.

The workflow infrastructure uses a prescriptive pattern to support calculated fields using parm methods that are defined within the workflow document class. These methods must be prefixed with parm and must implement a signature of (CompanyId, TableId, RecId). The workflow infrastructure then, at run time, calls the parm method and uses the return value in the condition evaluation. This design enables developers to implement calculated fields in parm methods on the workflow document class.

Note

When the expression builder constructs the list of fields, it uses the labels of the table fields as the display name for the fields. The display name for calculated fields is defined by the extended data type label of the return types. For enums, this is defined by the enum element label.


Creating a workflow document class involves creating an X++ class that extends from WorkflowDocument. You must override getQueryName to return the name of the workflow document query. Figure 5 shows a sample X++ class that extends from the workflow document.

Figure 5. A sample X++ class that extends from the workflow document

Creating a parm method involves adding a method to the workflow document class and then adding X++ code to calculate or otherwise determine the value to be returned, as you can see in Figure 6.

Figure 6. A parm method within a workflow document class that returns the approval amount (which is calculated)

Note

All condition comparisons assume that any literal monetary value typed into a condition is in AmountMST, which is the default company currency. Thus, if a parm method returns a value that represents a monetary amount, it must always be returned in AmountMST.


1.4 Adding a Workflow Display Menu Item

The workflow display menu items enable users to navigate directly to the Dynamics AX 2009 client form (or Enterprise Portal Web page) upon which they can select one of the available workflow actions. A user is prompted to participate in a workflow when he or she receives a work item from the workflow at run time. When viewing the work item, the user can click Go To <Label>. This button is automatically mapped to the workflow display menu item, and the button text (“<Label>”) is the label of the root table of the workflow document query.

This design enables developers to create task-based forms that are focused on the particular task at hand, rather than having to create monolithic forms that assume the user knows where in the process he or she is acting and which fields and buttons to use.

Other -----------------
- Workflow in Dynamics AX 2009 : Workflow Architecture
- SharePoint 2010 : Configuring Search Settings and the User Interface - Search Tabs and Pages
- SharePoint 2010 : Configuring Search Settings and the User Interface - Search Scopes
- SQL Server 2008 R2 : Performance Monitoring Tools (part 12) - Viewing Data Collector Set Results in Performance Monitor
- SQL Server 2008 R2 : Performance Monitoring Tools (part 11) - Creating Data Collector Sets in Performance Monitor
- SQL Server 2008 R2 : Performance Monitoring Tools (part 10) - Creating an Extended Events Session
- SQL Server 2008 R2 : Performance Monitoring Tools (part 9) - Creating an Extended Events Session
- SQL Server 2008 R2 : Performance Monitoring Tools (part 8) - Extended Events Catalog Views and DMVs
- SQL Server 2008 R2 : Performance Monitoring Tools (part 7) - SQL Server Extended Events
- SQL Server 2008 R2 : Performance Monitoring Tools (part 6) - SQL Server Utility
- SQL Server 2008 R2 : Performance Monitoring Tools (part 5) - Creating a Customized Data Collection Set
- SQL Server 2008 R2 : Performance Monitoring Tools (part 4) - Managing the Data Collector in T-SQL
- SQL Server 2008 R2 : Performance Monitoring Tools (part 3) - The System Data Collectors, Data Collector Reports
- SQL Server 2008 R2 : Performance Monitoring Tools (part 2) - Installing and Configuring the Data Collector
- SQL Server 2008 R2 : Performance Monitoring Tools (part 1)
- Microsoft Systems Management Server 2003 : Package Distribution and Management - Monitoring Status
- Microsoft Systems Management Server 2003 : Configuring the Client (part 4) - Managing the Advanced Client Download Cache, Advertised Programs Process Flow
- Microsoft Systems Management Server 2003 : Configuring the Client (part 3)
- Microsoft Systems Management Server 2003 : Configuring the Client (part 2) - Running Advertised Programs on Clients - Advertised Programs Wizard
- Microsoft Systems Management Server 2003 : Configuring the Client (part 1)
 
 
Most view of day
- Microsoft Visio 2010 : Modifying a Graphic (part 3) - Changing a Graphic’s Position
- Windows Home Server 2011 : Maintaining Windows Home Server - Checking Your Hard Disk for Errors
- Maintaining Dynamics GP : Safeguarding data by Backing Up everything
- Windows Server 2003 on HP ProLiant Servers : Active Directory Logical Design - Replication Topology (part 2)
- Client Access to Exchange Server 2007 : Using Cached Exchange Mode for Offline Functionality
- Working in the Background : WORKING WITH THE NETWORK LIST MANAGER
- Windows Phone 8 : The Multimedia Experience - Xbox Music Pass (part 2) - Playing Music from the Xbox Music Pass
- Windows Phone 8 : Designing for the Phone - The Third Screen
- SharePoint 2010 : Configuring Search Settings and the User Interface - Federated Search
- Windows Server 2008 : Configuring Server Core after Installation (part 4) - Setting the Time, Date, and Time Zone , Joining a Domain
Top 10
- Windows Phone 8 : Scheduled Tasks - Scheduled Task API Limitations
- Windows Phone 8 : Scheduled Tasks - Updating Tiles Using a Scheduled Task Agent
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 5) - Editing an Existing To-Do Item
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 4) - Creating the To-Do Item Shell Tile, Saving a To-Do Item
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 3) - Debugging Scheduled Tasks
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 2) - TodoService, TodoItemViewModel
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 1) - TodoItem,TodoDataContext
- Windows Phone 8 : Scheduled Tasks - Using Scheduled Tasks
- Windows Phone 8 : Scheduled Tasks - Background Agent Types
- Windows Phone 8 : Windows Phone Toolkit Animated Page Transitions - Reusing the Transition Attached Properties
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro