Fork task

A Fork task defines multiple sequences of tasks. A Fork task allows all its task sequences to be performed at the same time. After all the task sequences have been performed, the task after the Fork task is performed.

The following figure shows a simple example of a workflow that contains a Fork task.
Figure 1. Fork example
The image is explained in the text.

One thing to notice about the Fork task as it appears in the figure is that there is more of it than just its palette shape. The bottom of the Fork task is where the task sequences come together.

The purpose of the sample workflow shown in the figure is to get two approvals for the record that caused the workflow to be launched. Rather than waiting for one approval to be made before waiting for the second, the workflow waits for both approvals to happen at the same time. This way, the workflow can finish as soon as both approvals have been made, no matter which one happens first.

The workflow in the figure begins with a Fork task. The fork has two branches, one for each of the two approvals. The task after the fork is not performed until after all of the fork's branches are finished being performed, which is when both of the approvals have been done.

Each branch of the fork contains a similar sequence of tasks. It is not unusual for the branches of a fork to do different things. We chose an example in which the branches of a fork do similar things to keep the example simple. Each branch begins by creating a record for the kind of approval that the fork is responsible for. It then performs an approval task to get the appropriate approval.

When both approval tasks have completed, the fork is done. The task that follows the fork task is a switch task that causes the appropriate task to be performed, based on whether both approval tasks resulted in an approval or not.

You can click the top or bottom of a Fork task to see its properties form. A Fork task's properties form does not contain any properties. It does have two actions:

  • The form for a fork has a Delete action for deleting the Fork task. This should be used with care, since deleting a Fork task also deletes all the tasks in all its branches.
  • The form for a fork also has an Add Branch action. Clicking the Add Branch action has the effect of adding a new empty branch to the fork.

Clicking the circle at the bottom of a branch has the effect of selecting the branch and causing the properties form for the branch to be displayed. The properties form for a branch does not contain any properties, but it does have a Delete action for deleting the branch and all the tasks that the branch contains.

There are some benefits to allowing more than one thing to happen at the same time. The most obvious is that work can be completed sooner if some parts of the work can be done at the same time rather than completing the parts one after the other. If all the parts are done one after the other then the time required to finish the work will be the sum of the times it takes to perform each part. If all the parts are done at the same time, then the work takes only as long as the longest part.

When different parts of some work are being done at the same time, it is very important that the tasks being performed on the different parts do not interfere with each other. This one important consideration is the reason that the example in the figure is structured the way that it is structured.

Simply having two approval tasks try to approve the same record at the same time will not work because an approval task automatically locks the record to be approved from the time that the task starts until there is an action that ends the approval. This locking is not something that we want to try to bypass. The locking happens because it is always a bad idea to have one person modifying a record while someone else is modifying the record.

To avoid conflicts between whatever else is happening with the record being approved and the approvals, the example in the figure creates new records for the approval. Because each approval works on a record that exists only for that approval, there can be no possible interference between the approvals and anything else.