Workflow Logic

A Workflow is composed of specific tasks that are connected by paths that allow work to flow based on rules defined within each process. It can be an individual process that is defined to accomplish a specific set of operations (tasks) or a collection of processes which collectively serve to accomplish the business objectives of an organization.

With the advent of AutoMate BPA Server, developers can incorporate a new layer of logic to processes - workflow logic. This logic is expressed primarily with a combination of Conditions, Tasks, Evaluation object and Flow Control Arrows. There are three types of flow control arrows; Result Arrow, Success Arrow, and Failure Arrow. At first glance, these all seem pretty self-explanatory. However, arrows can behave differently depending on which object is their parent (i.e. which object they stem from). They don't simply connect two objects together, but they have fundamental meaning as well.

To get a better understanding of flow control arrow behavior, and to learn the do's and don'ts of arrows, learning by exam­ple is the best approach. The following cases will illustrate the basics of incorporating workflow logic into an automated processes. In CASE 1 through CASE 5, we will examine arrow behavior when the arrows stem from the Evaluation object. CASE 6 through CASE 9 deal with arrow behavior when the arrows stem from Conditions. And the balance of cases deals with arrow behavior associated with Tasks.

Related Topics

CASE 1

Description:

In the example below, an Evaluation object holds the expression 3=4 (which of course amounts to FALSE) and linked to 5 separate flow control arrows, each pointing to a separate task. At runtime, the expression 3=4 will be evaluated to determine the workflow's course. Which tasks will the workflow continue to during execution? 

Progression:

  • FAILURE (red) arrow proceeds to Task 2.

  • RESULT (blue) arrow with the value FALSE proceeds to Task 4.

  • All other paths are ignored. Tasks 1, 3, and 5 do not execute.

Explanation:

Evaluations that return TRUE/YES are treated as a SUCCESS and FALSE/NO are treated as a FAILURE. Since the expression 3=4 evaluates to FALSE, the workflow will proceed to both the RESULT arrow set to FALSE and the FAILURE arrow.

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 for evaluation objects.

 

CASE 2

Description:

In the example below, the Evaluation object holds the expression 4=4 (which results to TRUE) and is linked to 5 separate tasks in exactly the same manner as the workflow above. What should happen during execution of this work­flow?

Progression:

  • SUCCESS (green) arrow proceeds to Task 1

  • RESULT (blue) arrow with the value TRUE proceeds to Task 3.

  • All other arrows are ignored. Tasks 2, 4, and 5 do not execute.

Explanation:

Evaluations that result to TRUE/YES are treated as a SUCCESS and FALSE/NO are treated as a FAILURE. Since the expression 4=4 results to TRUE, the path will follow both the RESULT arrow set to TRUE and SUCCESS arrow.

 

CASE 3

Description:

In this example, the Evaluation object is set to the value of a shared variable defined within the workflow named 'myVariable'. This variable is currently populated with the value of 5. What should happen in the following workflow?

Progression:

  • The RESULT (blue) arrow that holds the value of 5 continues to Task 5.

  • All other paths are ignored. Tasks 1, through 4 do not execute.

Explanation:

The evaluation object returned 5. Only the RESULT arrow with a corresponding value of 5 matches the variable, therefore, it's the only path that results to TRUE.

 

CASE 4

Description:

In this example, the Evaluation object is set to the value of a shared variable defined within the workflow named 'myVariable'. Unlike case 3, this variable is currently populated with the value of 10. What should happen during execution of this work­flow?

Progression:

  • All paths are ignored. No tasks execute, but the workflow does not fail. It completes successfully.

Explanation:

The evaluation object returned 10, which is not equivalent to SUCCESS, FAILURE, TRUE, FALSE or 5.

 

CASE 5

Description:

In this example, the Evaluation object is set to the value 4=*+/=4. The syntax of this expression is wrong. It cannot be resolved to any value. What should happen during execution of this work­flow?

Progression:

  • All paths are ignored. No tasks execute, and the workflow fails with an error.

Explanation:

The expression 4=*+/=4 is a code syntax error, therefore, the workflow should stop and throw an error.

 

CASE 6

Description:

In this example, the File condition is set to wait indefinitely for any text file (*.txt) to appear in the root of c:\ and trigger workflow execution as a result.  What should happen when a text file eventually arrives in C:\?

Progression:

1.   SUCCESS (green) arrow proceeds to Task 1

2.   RESULT (blue) arrow set to TRUE proceeds to Task 3

All other paths are ignored. Tasks 2, 4, and 5 do not execute.

Explanation:

The condition returned TRUE, which is equivalent to the SUCCESS arrow and RESULT arrow set to the value TRUE.

NOTE: It is important to remember that conditions cannot fail in their execution. They are similar to an evaluation object in that they evaluate a particular condition and return TRUE/1 or FALSE/0. Flow control arrows stemming from a Condition object react similarly to the way they do when stemming from an Evaluation object. When a condition returns TRUE/1, it is treated as a SUCCESS. When a FALSE/0 is returned, it is treated as a FAILURE.

 

CASE 7

Description:

In this example, the File condition is set to wait for a text file to appear on C:\ for up to 1 minute, at which point, a timeout error occurs. What should happen when a text file doesn't arrive in C:\ after the condition has been active for 10 seconds?

Progression:

1.   FAILURE (red) arrow proceeds to Task 2.

2.   RESULT (blue) arrow with the value FALSE proceeds to Task 4.

All other paths are ignored. Tasks 1, 3, and 5 do not execute.

Explanation:

The condition resolved to FALSE. Consequently, the path will follow both the RESULT arrow a matching value and the FAILURE arrow since FALSE/0 is treated as a FAILURE.

NOTE: It is important to remember that conditions cannot fail in their execution. They are similar to an evaluation object in that they evaluate a particular condition and return TRUE/1 or FALSE/0. Flow control arrows stemming from a Condition object react similarly to the way they do when stemming from an Evaluation object. When a condition returns TRUE/1, it is treated as a SUCCESS. When a FALSE/0 is returned, it is treated as a FAILURE.

 

CASE 8

Description:

In this example, the File condition is set as a conditional object. It evaluates if any text file resides in the root of c:\ and determines the course of the workflow dependant on the result. What should happen if a text file is present on C:\?

Progression:

1.   SUCCESS (green) arrow proceeds to Task 1.

2.   RESULT (blue) arrow with value of TRUE proceeds to Task 3.

All other paths are ignored. Tasks 2, 4, and 5 do not execute.

Explanation:

The Condition resolved to TRUE. Consequently, the path will follow both the TRUE RESULT arrow and the SUCCESS ­arrow.

 

CASE 9

Description:

This workflow is similar to the previous example (CASE 8). The File condition is set as a conditional object that evaluates if any text file resides in the root of c:\ and determines the course of the workflow depending on the result. What should happen if no text file is present on C:\?

Progression:

1.   SUCCESS (green) arrow proceeds to Task 1.

2.   RESULT (blue) arrow with value of TRUE proceeds to Task 3.

All other paths are ignored. Tasks 2, 4, and 5 do not execute.

Explanation:

The Condition resolved to FALSE. Consequently, the path will follow both the FALSE RESULT arrow and the FAILURE ­arrow.

 

CASE 10

Description:

In this example. the workflow contains a Task object named 'Main' linked to 5 separate flow control arrows, each pointing to a separate task. What should happen if the 'Main' task fails during execution?

Progression:

FAILURE (red) arrow proceeds to Task 2.

All other paths are ignored. Tasks 1, 3, 4 and 5 do not execute.

Explanation:

The Task resulted in a Failure and can only proceed down a FAILURE arrow path.

 

CASE 11

Description:

Similar to the previous workflow, this workflow contains a Task object named 'Main' linked to 5 separate flow control arrows, each pointing to a separate task. What should happen if the 'Main' task successfully completes its execution?

Progression:

SUCCESS (green) arrow proceeds to Task 1.

All other paths are ignored. Tasks 2, 3, 4 and 5 do not execute.

Explanation:

The Task resulted in a success and can only proceed down a SUCCESS arrow path.