| Previous | Next |  | Contents | Index | Glossary

## Master/Detail Coordination Activities

The Master/Detail coordination activities let you coordinate the flow of master and detail processes. For example, a master process may spawn detail processes that need to be coordinated such that the master process continues only when every detail process has reached a certain point in its flow or vice versa.

When you spawn a detail process from a master process in Oracle Workflow, you are in effect creating a separate process with its own unique item type and item key. You define the master/detail relationship between the two processes by making a call to the Workflow Engine SetItemParent API after you call the CreateProcess API and before you call the StartProcess API when you create the detail process. See: SetItemParent.

You can then use the two activities described below to coordinate the flow in the master and detail processes. One activity lets you pause a process and the other signals the halted process to continue. To use these activities, you place one activity in the master process and the other in each detail process.

Both activities contain two activity attributes that you use to identify the coordinating activity in the other process(es).

### Wait for Flow Activity

Place this activity in a master or detail process to pause the flow until the other corresponding detail or master process completes a specified activity. This activity calls a PL/SQL procedure named WF_STANDARD.WAITFORFLOW.

#### Activity Attributes

The Wait for Flow activity contains two activity attributes:

- Continuation Flow--specify whether this activity is waiting for a corresponding "Master" or "Detail" process to complete.

- Continuation Activity--specify the label of the activity node that must complete in the corresponding process before the current process continues. The default value is CONTINUEFLOW. See: To Define Activity Attribute Values.

### Continue Flow Activity

Use this activity to mark the position in the corresponding detail or master process where, upon completion, you want the halted process to continue. This activity calls a PL/SQL procedure named WF_STANDARD.CONTINUEFLOW.

#### Activity Attributes

The Continue Flow activity contains two activity attributes:

- Waiting Flow--specify whether the halted process that is waiting for this activity to complete is a "Master" or "Detail" flow.

- Waiting Activity--specify the label of the activity node in the halted process that is waiting for this activity to complete. See: To Define Activity Attribute Values.

#### Example

The following figures show an example of how these coordination activities can be used. In the master process below, the Start Detail Flows activity initiates several detail processes. The master process then completes Activity 1 before it pauses at the Wait For Flow activity. Wait For Flow is defined to wait for all its detail processes to complete a Continue Flow activity before allowing the master process to transition to Activity 2. An example of one of the detail processes below shows that when the detail process begins, it completes Activity A. When it reaches the Continue Flow activity, it signals to the Workflow Engine that the master process can now continue from the Wait For Flow activity. The detail process itself then transitions to Activity B.

Master Process

Detail Process

> Note: You can include a Wait for Flow activity in a master process without using a Continue Flow activity in one or more of its corresponding detail process. The Workflow Engine simply continues the master process as soon as all the other detail processes that do contain a Continue Flow activity complete the Continue Flow activity.

> If it does not matter when any of the detail processes complete before a master process continues (or when a master process completes before all the detail processes continue), then you simply omit both of the coordination activities from your master/detail processes.

> Attention: If you include a Continue Flow activity in a process, you must also include a Wait for Flow activity in its corresponding master or detail process as defined by the activity attributes in the Continue Flow activity.

| Previous | Next |  | Contents | Index | Glossary