Transcript
Page 1: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Workflow in Dynamics AX 2012

By,Nasheet Ahmed Siddiqui

Page 2: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Agenda• Workflow overview• Workflow development

• Query for a Workflow • Workflow category• Workflow type • Workflow elements• Enable workflow on form• Workflow Providers Overview

• Workflow configuration

Page 3: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

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.

Workflow overview

Page 4: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Workflow overview

• Developer design the workflow based on customer requirements.

• The company administrator configures the workflow.• Users run the workflow.

Page 5: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

The developer role in Microsoft Dynamics AX is

primarily to add workflow to existing business documents or create new documents that support workflow.

Creating a query for a workflow. Creating a workflow category. Creating a workflow type in the AOT. Creating Workflow elements Enable workflow on the form.

Workflow development

Page 6: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

In the AOT, right-click the Queries node, and then select New

Query. A query group displays under the Queries node. Right-click the new query, click Rename, and then enter

MyQuery. Expand the new query, right-click the Data Sources node, and

then click New Data Source. A data source group displays under the Data Sources node.

Right-click the new data source group and then click Properties. In the Properties sheet, set the Table property to CustTable. Expand the CusTable_1 data source, and select the Fields node.

In the Properties sheet, set the Dynamic property to Yes.

Query for a Workflow

Page 7: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

In the AOT, expand the Workflow node. Right-click the Workflow Categories node, and then

select New Workflow Category. A new workflow category group displays under the Workflow Categories node.

Right-click the new workflow category and then click Properties.

In the Properties sheet, set the name and module properties.

In the AOT, right-click MyWorkflowCategory, and then click Save.

Workflow Category

Page 8: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

The Workflow type is a building block that can be used to

create customized workflows that enforce business policies. In Microsoft Dynamics AX, you enable the workflow process

for a workflow document by creating Workflow types that are used in the workflow configuration user interface.

A Workflow type defines information about: Which workflow document to use. Tasks and approvals that can be configured by the end-user. Workflow categories used for assigning a Workflow type to a

specific module. Menu items and event handlers.

Workflow Type

Page 9: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

In AOT->Workflow->Workflow Types->New

Workflow type.

Workflow Type

Page 10: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

The workflow document class that you create

defines table fields for conditions in two ways:1. The Application Object Tree (AOT) query. The

getQueryName method of the Workflow Document Class must be overridden to return the name of the query.

2. Parameter methods. You can optionally add calculated fields by adding parameter methods with a specific signature on the class.

Workflow Type(Define the workflow document)

Page 11: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Microsoft Dynamics AX workflow uses events to

initiate business logic in your application. For example, the workflow type has a property event handler for business logic when a workflow is started.

Workflow event handlers in Microsoft Dynamics AX enable you to run application-specific business logic at key points during workflow execution. Workflow events are implemented at the workflow level and the workflow element level

Workflow Events

Page 12: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Event Description

WorkflowStartedEventHandler

This event raises when the workflow instance starts.

WorkflowCompletedEventHandler

This event raises when the workflow instance ends after it is completed.

WorkflowCanceledEventHandler

This event raises when the workflow instance ends after it is canceled. Use this event handler to perform any cleanup operations needed.

WorkflowConfigDataChangeEventHandler

This event raises when the workflow configuration data changes. Use this event handler to identify when a configuration has changed. For example, if you create an association between the application data and a workflow configuration, this event handler would raise if the configuration was deleted or updated.

Workflow Level Event Handlers

• At the workflow level, event handlers are provided for the workflow started, completed, canceled, and configuration data change events.

• WorkflowHandler class implements WorkflowCanceledEventHandler, WorkflowCompletedEventHandler, WorkflowStartedEventHandler.

• Started,completed and canceled methods create to handle below events.

Page 13: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Create a submitWorkflow and CancelWorflow

menuitems. Set the object property of submitwork

menuitem to the SubmitWorkflow class. Set the object property of CancelWorflow

menuitem to the WorkflowCancelManager class.

Workflow Menu Items

Page 14: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

In Microsoft Dynamics AX, a workflow is

started when the user clicks the Submit button on the workflow toolbar.

The Submit button is bound to an action menu item that calls the main method on a SubmitToWorkflow class.

Workflow activation is added in the main method from the workflow type name.

SubmitToWorkflow Class

Page 15: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

public static void main(Args args) { // Variable declaration. recId _recId = args.record().RecId; WorkflowCorrelationId _workflowCorrelationId; // Hardcoded type name workflowTypeName _workflowTypeName = workFlowTypeStr("MyWorkflowType"); // Initial note is the information that users enter when they // submit the document for workflow. WorkflowComment _initialNote = ""; WorkflowSubmitDialog workflowSubmitDialog;

// Opens the submit to workflow dialog. workflowSubmitDialog = WorkflowSubmitDialog::construct(args.caller().getActiveWorkflowConfiguration()); workflowSubmitDialog.run();

if (workflowSubmitDialog.parmIsClosedOK()) { _recId = args.record().RecId; // Get comments from the submit to workflow dialog. _initialNote = workflowSubmitDialog.parmWorkflowComment();

try { ttsbegin;

// Activate the workflow. _workflowCorrelationId = Workflow::activateFromWorkflowType(_workflowTypeName, _recId, _initialNote, NoYes::No);

// Send an Infolog message. info("Submitted to workflow.");

ttscommit; }

catch(exception::Error) { info("Error on workflow activation."); } } }

SubmitToWorkflow Class

Page 16: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

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, approval, or a sub-workflow.

A task is a workflow element with a single step defined in the Application Object Tree (AOT) that is used to implement task-based processes.  

An approval is a specialized task that can have multiple steps defined in the AOT that is used to implement approval processes.

Workflow elements

Page 17: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

You can use workflow approvals to track the status

of a workflow document that has fixed workflow outcome types such as Approve, Reject, Deny, or RequestChange.

AOT->WorkFlow>Approvals-> New Approval Associate an Action Menu Item with a Workflow

Approval Associate a Display Menu item with a Workflow

Approval Create and implement event handlers on the

workflow approval

Create a Workflow Approval

Page 18: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

A workflow may contain one or more tasks.

However, each task may only contain one step with one or more outcome types.

AOT->WorkFlow->Tasks-> New Task Associate an Action Menu Item with a

Workflow Task Associate a Display Menu item with a

Workflow Task Create and implement event handlers on the

workflow task

Create a Workflow Task

Page 19: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Property Value

WorkflowEnabled Yes

WorkflowDataSource CustTable

WorkflowType CustWorkflow

Enable Workflow on Form

1.In the AOT, expand the Forms node. 2.Expand the CustTable form, and then expand the Designs node. 3.In the Designs node, right-click the Design child node, and then click Properties. 4.In the Properties sheet, set the following properties.

5.In the AOT, right-click the CustTable form, and then click Save.

Page 20: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

After the form is enabled for workflow, you will

add a canSubmitToWorkflow method to the form. This method runs before the Submit button is enabled to verify that the workflow document is in a valid state to submit to workflow.

Enable Workflow on Form

Page 21: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

In Microsoft Dynamics AX, you can use

workflow providers to provide application-specific information to a workflow instance at runtime.

For example, you can use workflow providers to determine who is required to approve an invoice, or by which date an invoice payment is considered to be late.

Workflow Providers

Page 22: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Hierarchy Assignment

Determines a user ID based on a search in a hierarchy.

Due date  Determines the due date for a task or approval,

or the due date for a step in a task or approval. 

Participant  Resolves a user group or role into one or more

specific user IDs. 

Workflow Providers Types

Page 23: By, Nasheet Ahmed Siddiqui.  Agenda Workflow overview Workflow development Query for a Workflow Workflow category Workflow type Workflow elements Enable

Demo


Top Related