Workflow Control

by Ricardo Castaneda, in Tech Talk, posted 3/28/08

 With AutoMate BPA Server 7, automation developers have a new layer of logic they can add to processes at the Workflow level.  Flow Controls – including arrows and the Evaluation object – are decision-making tools that provide flexibility and determine the path a workflow will take.  For example, if the result of a task is successful, the next step in the workflow will be different than if the result is a failure.  Flow controls connect tasks, events, and conditions together to make the workflow a cohesive unit.

BPA Server 7’s Workflow logic is expressed with a combination of Arrows and the Evaluation object. The arrows act as the glue that binds all the other objects together.  There are three types of flow control arrows, which are called ‘Result’, ‘Success’, and ‘Failure’.

There are some basic practices to follow when using arrows to link from one object (i.e., the arrow’s parent) to another object.  Only Success and Failure arrows should be used to link from Tasks and Conditions to other objects because they are the only objects in Workflow Designer that can Succeed or Fail.  The Result arrow should only be used to link from the Evaluation object to other objects because only the Evaluation object can provide an answer (i.e., the result) to a question (i.e., the evaluation).  And finally, only the Success arrow should be employed to link from Event objects (Schedule and Key events) to other objects because Event objects can only be used to trigger workflows.  An example of this would be if BPA Server 7 could only understand the key press “Alt-a” to be a successful triggering event for a workflow.

Success Arrow:

The Success Arrow stems from a parent object (task, condition, or event) and will continue to the next downstream object upon successful execution of the parent.  In the example below, a Success arrow will run Task 1 when the Schedule Event (“Time” icon) successfully executes.  If Task 1 completes successfully, then Task 2 will execute. If any one of these objects fails during execution, the workflow will also fail and execution will come to a halt.
Another scenario would be to execute two or more tasks simultaneously.  As shown in the example below, when the Schedule Event triggers successfully, Task 1 and Task 2 execute at the same time.
Failure Arrow:

The Failure Arrow stems from tasks or conditions and will only allow the workflow to proceed if the parent object fails.  In the example below, if either Task 1 or Task 2 fails, the workflow will execute the task, “Send Email.”

A combination of flow control arrows can be used as well. In the example below, the workflow will proceed to Task 2 if Task 1 executes successfully.  However, if Task 1 fails, the workflow will proceed to the task, “Send Email.” 

The Evaluation object determines the value of a variable, expression, or hard-coded value generated within the workflow.  It returns a result which can be true, false, or some other value.  Together, the Evaluation object and Result arrow can be used to change the execution path of a workflow.  An example of a simple expression is shown below.

Result Arrow:

The Result arrow stems from an Evaluation object and determines the path the workflow will follow depending on the value of the preceding object.  The value assigned to the result arrow must correspond with the value returned by the preceding object.  You must double click the Result arrow in order to select the desired value.  Let’s take the simple expression above and combine it with the example below.  The Shared Variables view shows that both Var1 and Var2 have the same current value, which is “Hello World!”  Therefore, since the expression used is Var1=Var2, the workflow will proceed to the Result arrow that evaluates to True and will execute Task 1.

Note: To avoid confusion, always use the Result arrow to stem from Evaluation objects.  The Result arrow provides all the functionality you will need, plus it is clearer than using Success or Failure arrows.