Workflows Explained

From ADempiere ERP Wiki

Jump to: navigation, search

Table of Contents | Workflows Explained

Overview

A Workflow is the process by which a document moves from person to person as each adds value or approvals to the document. Within ADempiere, an effective workflow process provides speed and efficiency in the movement of information from person to person and ensures that the proper controls are applied.

Workflows can be established and maintained by the Administrator as required to meet the needs of the organization. Typically, workflows involve approval, where one person creates a document and another person is responsible to review and approve it. The workflow can be extended to cover a variety of actions and review steps with sequential or parallel paths.

How a Workflow Works

Workflows involve a series of steps, called Nodes, and the document "flows" or transitions from node to node. Each node represents a step in the process and the transition from one node to the next is based on conditions.

The default workflow for each document is automatic approval - in other words, the user can approve their own documents. The workflow involves a simple series of steps, each of which performs some action. The actions in this case will automatically complete a document. The image below shows what this looks like. Each workflow has a start node which is triggered by the user action to complete the document. The rectangular boxes with names like (DocPrepare) are the nodes that perform the associated actions for that document. The node names in brackets () are system nodes - the default nodes available to each document.


File:Default workflow.png

The numbers on the transitions from one node to the next show the order in which the transitions are processed. The lowest number is used first. System level transitions are all 100 or higher. In most custom workflows, the transition numbers used should be lower than 100. For cases where there are multiple possible transitions, the number of the transition can be used to provide a priority: the lowest number transition with a successful condition will be followed.

In the standard process, the Is Approved field is set to yes automatically. For most approval processes, the Is Approved field is set by the approval authority and this is a common step in most workflows.

As a simple example in GardenWorld, we can create an approval process for a Purchase Order workflow so the PO Document will require manual approval if the total lines exceed $100. The approval authority will be defined by the roles. To complete the workflow, we'll also send the document back to the Invoker (the user who generated the Purchase Order) with a note to process the order.

The process will look like this:


File:Sample approval workflow.png


The shaded elements are performed automatically by the system. The approval decision is provided by an action called a "User Choice", in this case a Yes or No answer. We can set the results of the User Choice action for the IsApproved column, in which case the software will automatically deal with the results if the authority does not approve the document. The workflow can also be configured to send the invoking user an e-mail notice if the document is not approved.

On the transitions, again, the lower numbers are tried first, but if the Conditions for that transition fail, the next transition will be tied. So if the Total Lines is less than $100, the standard process will be followed and the PO document will be automatically approved and completed.

We will have to deal with the non-shaded nodes ourselves.

To setup this workflow, we need to create three nodes and three transitions, one with a condition, as follows:

  • Open the Workflow window and find the workflow “Process_Order”
  • Create a new node
    • Set the Search Key to “Approve”
    • Set the Name to “For your approval.”
    • Set the Description to “This purchase order requires your approval.”
    • Set the Action to “User Choice”
    • Set the Column to “IsApproved_Approved”
  • Create a new node
    • Set the Search Key to “DocComplete”
    • Set the Name to “DocComplete”
    • Set the Action to “Document Action”
    • Set the Document Action to “Complete”
  • Create a new node
    • Set the Search Key to “Process”
    • Set the Name to “Approved. Please print and process.”
    • Set the Description to “The order has been approved and can be sent to the vendor.”
    • Set the Action to “User Window”
    • Set the Window to “Purchase Order”
  • Find the node “(DocPrepare)”
    • Create a new Transition
    • Set the Next Node to “For your approval.”
    • Set the Sequence to “10”
    • Set the Description to “Total lines > 10”
    • Deselect Std User Workflow
  • Find the node “For your approval.”
    • Create a new Transition
    • Set the Next Node to “DocComplete”
    • Set the Sequence to “10”
    • Set the Description to “Process”
    • Select Std User Workflow (The Std User Workflow can be selected because we are using a standard process to complete the document.)
  • Find the node “DocComplete”
    • Create a new Transition
    • Set the Next Node to “Approved. Please print and process.”
    • Set the Sequence to “10”
    • Set the Description to “Approved.”
    • Deselect Std User Workflow

We also need to ensure that the GardenAdmin user can approve the purchase order amounts.

  • Open the “Role” window
  • Find the “GardenWorld Admin” role.
  • Set the Approval Amount to 1000. (Note - if this is the highest level of authority, set the approval amount to well above the largest expected transaction amount. Otherwise, a workflow with a higher transaction amount will be stuck with no appropriate level of authority).
  • Save the record and log out.

The GardenUser account and role cannot approve their own documents but with the transition condition set to $100, this effectively means that they cannot approve documents above $100. Every document below that amount will be automatically approved.

To test the workflow, login as GardenUser and create a Standard (not POS) sales order for Joe Block for a single Azalea Bush. As GardenUser, you should be able to complete this document as the total value is below the $100 level so the standard process is used. The document status will show "Completed".

Try to create and complete another order for 20 Oak Trees. This will exceed the $100 approval limit and will trigger the custom workflow. The document will show a status of “In Progress” and a warning will be shown if GardenUser tries to update the document action again.

Log out and then log in as GardenAdmin. There should be a new workflow in the Activities pane. Opening this pane will show a screen similar to the one below:


File:Workflow action.png


The Activities Pane shows that there is a request for approval and some information about the process. Below the history is a field labeled Answer and a pull down box with Yes or No as possible answers. On the right there is a search button which will open the sales order in question. Below search button is the confirm button.

The Answer field is the user action. This is the approval step. Selecting “Yes” in the Answer box and clicking the confirm button indicates that the document is approved. The workflow will then transition to the new DocComplete node where the document status will be set to Complete. Then the workflow will transition and send the PO back to the user to action.

Log in again as GardenUser and there should be a new workflow in the Activities pane. The user will note the approved message and can print the PO for transmission to the supplier.

This is a simple example with some simple actions. More workflows actions can be configured with parallel recommendation and/or approval paths based on data in the documents and a variety of actions.

See Also

Personal tools