>

Tag Archives: Workflow

Walkthrough: Creating a Workflow Template AX 2009

In Microsoft Dynamics AX, you define a workflow by creating a template to base the workflow on. In this walkthrough, you will create a workflow template in the Application Object Tree (AOT) that you can add approvals and tasks to.

A workflow template defines information about:

  • Which workflow document to use. The workflow document exposes calculated fields and identifies the query that exposes data fields for the workflow.
  • Tasks and approvals that can be configured by the end user.
  • Workflow categories used for assigning a workflow template to a specific module.
  • Menu items and event handlers.

This walkthrough illustrates the following tasks:

  • Create a workflow template in the AOT.
  • Create a query to expose data for conditions.
  • Create a workflow document class to identify the query and calculated fields.
  • Bind the query to the workflow document class.
  • Bind the workflow document class to the workflow template.
  • Create a workflow category.
  • Bind the workflow category to the workflow template.
  • Create a SubmitToWorkflow menu item.
  • Bind the workflow menu item to the workflow template.
  • Set a license configuration key for the workflow template.

Prerequisites

 

To complete this walkthrough, you will need:

  • Microsoft Dynamics AX
  • A license file that has access to the MorphX development environment
To create a workflow template in the AOT
  1. In the AOT, expand the Workflow node.
  2. Right-click the Workflow Templates node, and then select New Workflow Template. A workflow template group displays under the Workflow Template node.
  3. Right-click the new workflow template and then click Properties.
  4. In the Properties sheet, set the Name property to MyWorkflowTemplate.
  5. In the AOT, right-click MyWorkflowTemplate, and then click Save.

After the workflow template is created, you can create the objects that you need to bind to the workflow template. For this walkthrough, the next step is to create a query to identify the table data fields used for the workflow document.

To complete Article click here

Dynamics AX Workflow types – AX 2012

To create a workflow, you must first select the type of workflow that you want to create. This topic lists the types of workflows that you can create in each module. The topic also describes what each type of workflow is used for, and whether the workflows of each type are associated with a specific company in the organization or with the whole organization.

https://technet.microsoft.com/en-us/library/dd362043.aspx

Configure the workflow notification options [AX 2012]

Notifications may be sent to you when workflow-related events occur. For example, a notification may be sent to you when a document is assigned to you for approval or when the workflow process is completed for a document that you submitted. You can specify how you want to receive workflow notifications.

  1. Click File > Tools > Options.

  2. In the left pane of the Options form, click Notifications.

  3. In the Receive notifications every (minutes) field, enter the number of minutes to specify how often you want to receive notifications.

  4. In the Line-item notification type list, specify how you want to receive workflow notifications for line items from the following options:

    • Grouped – Notifications for line items are grouped into a single notification.

    • Individual – A notification is sent for each line item.

  5. To receive notifications in the Microsoft Dynamics AX client, select the Show notifications in the Microsoft Dynamics AX client check box.

    If you select the Show notifications in the Microsoft Dynamics AX client check box, you can also specify whether you want to receive notifications as pop-up messages. To receive pop-up messages, select the Show pop-ups for notifications check box.

  6. To receive notifications as email, select the Send notifications in email check box.

How to: Create a Workflow Task AX 2012

A Microsoft Dynamics AX workflow task is a single unit of work that must be performed. A workflow may contain one or more tasks.

The following procedure describes how to create a new workflow task in the AOT.

To create a workflow task

  1. In the AOT, expand the Workflow node.
  2. Right-click the Tasks node, and then click Add-Ins > Task wizard. The Workflow wizard is displayed. This wizard will help you create a new workflow task.
  3. Click Next.
  4. Set the following values for the wizard.

Value

Description

Name

The name that will be used for the workflow task.

Workflow document

The class that defines the workflow document for which you are creating a task.

clip_image001Note

This setting must match the Document property setting used in the workflow type for the task.

Document preview field group

The initial set of fields displayed in the unified work list. Select a field group from the root table specified in the Workflow document that you selected. The Workflow document value must be set before you can select a field group.

Document menu item

Choose the menu item that points to the main form that displays the document for which you are creating a workflow task.

Document web menu item

Choose the web menu item that points to the Enterprise Portal page that displays the document for which you are creating a workflow task.

  1. Specify which types of menu items you want to create. You can create menu items for the Microsoft Dynamics AX client, web menu items for Enterprise Portal, or items for both.
  2. Click Next.
  3. Define the task outcomes. For each outcome that you want to support, supply a Name for the outcome. The name cannot contain spaces. Specify the Type for the outcome. Choose one of the following types:
    • Complete – Completes the workflow task and continues the workflow forward.
    • Return – Returns the task to the originator for changes and then resubmission back to workflow.
    • RequestChange – Sends the task to a specified user for changes and then resubmission back to workflow.
    • Deny – Completes the task as denied and continues the workflow forward.

Click Add.

Note

Each task must have one outcome of type Complete.

  1. After you have finished defining the outcomes, click Next. A list of all of the resources that will be created for the workflow task is displayed.
  2. Click Finish to create the resources. The wizard will create classes, menu items, web menu items, the task, and a project that contains all of the items.
  3. A dialog box will be displayed that indicates the status. Click OK. The project that contains the workflow type resources is displayed.

After a workflow task is created, you can add the workflow task to the Supported Elements node of a workflow type.

How to: Create a Workflow Document Class [AX 2012]

Microsoft Dynamics AX table fields are defined in a query to create workflow conditions. A limitation of a Microsoft Dynamics AX query is that you cannot define calculated fields in the query itself. It is a common scenario to use calculated fields to determine the behavior of a workflow. For example, a dynamic sales total of all records in a table can be used as a workflow condition to determine whether the step should be used. To overcome this query limitation, you must use a workflow document class.

The workflow document class that you create defines table fields for conditions in two ways: the Application Object Tree (AOT) query and parameter methods. The getQueryName method of the WorkflowDocument Class must be overridden to return the name of the query. You can optionally add calculated fields by adding parameter methods with a specific signature on the class.

Before you begin these procedures, you must create a query that specifies the data that will be accessed.

The following procedures show how to create a workflow document class including a parameter method for a calculated field.

NoteNote

If you used the Workflow Wizard to create the workflow type, the workflow document class will have already been created by the wizard.

To create a workflow document class
  1. In the AOT, expand the Classes node.

  2. Right-click the Classes node, and then select New Class. A class group displays under the Classes node.

  3. Right-click the new class, click Rename, and then enter a name for the workflow document class.

  4. Expand the new class, select classDeclaration, right-click the class declaration, and then click Edit.

  5. Enter the following code in the class declaration.

    X++

    class <MyWorkflowDocumentClassName> extends WorkflowDocument
    {
    }
  6. Close the Editor window and click Yes to save changes.

  7. Right-click the new class, point to Override Method, and then click getQueryName. A method node named getQueryName displays under the workflow document class node and the Editor window opens.

    NoteNote

    Be sure to select getQueryName as the method to override. The WorkflowDocument.getQuery Method is used only internally to retrieve the actual query based on the string returned by theWorkflowDocument.getQueryName Method.

  8. In the Editor window, enter the following code for the query method.

    X++

    QueryName getQueryName()
    {
        return querystr(<MyWorkflowDocumentQueryName>);
    }

After you create the workflow document class, you can bind it to the workflow type. For more information, see How to: Associate a Workflow Document Class with a Workflow Type.

To add a calculated field to the workflow document class, it must:

  • Be named parm <name>.

  • Define the parameters CompanyId, TableId, and RecId.

  • Return an extended data type that will be included in the list of fields for defining conditions or notification messages. The label for the EDT must uniquely identify the value.

To add a calculated field to the workflow document class
  1. In the workflow document class that you want to add a calculated field to, right-click the class, and then click New Method. A new method node displays under the Classes node.

  2. Right-click the new method node, and then click Edit. Enter code that uses the format shown in the following code example.

The following code example shows how to add a calculated field to determine the total credit amount for a journal.

X++

public TotalJournalCreditAmount parmTotalJournalCreditAmount(CompanyId _companyId, TableId _tableId, RecId _recId)
{
    // The calculateAmounts method contains business and validation logic   
    this.calculateAmounts(_companyId, _tableId, _recId);

    return totalJournalCreditAmount;
}
Follow

Get every new post on this blog delivered to your Inbox.

Join other followers:

error: Content is protected !!