Work with Subprocesses

You can use subprocesses to organize your business processes. Subprocesses lets you group functional areas of your business process together and also make your business processes more readable.

Process supports the following types of subprocesses:

  • Reusable processes

  • Embedded (also called inline) subprocesses

In addition, you can configure multi-instance markers in subprocesses.

About Reusable Processes (Reusable Subprocesses)

Process supports reusable processes, sometimes referred to as reusable subprocesses. Reusable processes let you create business processes that can be called from other business processes.

For example, all your business processes may have to charge a credit card, so you can create a charge credit card reusable subprocess.

Reusable processes have the following characteristics:

  • Must start with one none start event.

  • Can contain multiple end events.

  • Can only be called by other business processes.

About Embedded Subprocesses (Inline Subprocesses)

Embedded subprocesses let you group flow elements together to make your business process more readable. In Process, subprocesses are embedded subprocesses. Subprocesses are contained as part of the parent subprocess. Embedded subprocesses must begin with a start none event and must end with a none end event.

Embedded subprocesses can be expanded or collapsed. The following is an example of how a collapsed subprocess appears within a process flow.

Description of embedded-collapsed.png follows
Description of the illustration embedded-collapsed.png

The following diagram shows how an expanded embedded subprocess appears within a process flow. When an embedded subprocess is expanded, you can edit the flow elements within it. You can also click and drag the edge of the embedded subprocess window to change its size.

Description of embedded-expanded.png follows
Description of the illustration embedded-expanded.png

Similar to other types of business processes, embedded subprocesses can have start and end events and contain a separate process flow. An embedded subprocess must begin with a none start event and end with a none end event. Embedded subprocesses can’t contain swimlanes.

Embedded subprocesses also behave similar to activities. They can have incoming and outgoing sequence flows. They also contain data associations that define the data objects used within the embedded subprocesses.

Embedded subprocesses can also contain timer, message, and error boundary events.

If necessary, your business process can contain nested embedded subprocesses. However, use nested embedded subprocesses only when necessary to make your business process more readable.

Note:

Creating data objects for an embedded subprocess isn’t supported.

Embedded Subprocesses and Sequence Flows

The flow elements within an embedded subprocess can’t have sequence flows that connect to flow elements outside the subprocess.

Similar to other flow elements, embedded subprocesses have incoming and outgoing sequence flows.

Embedded Subprocesses in Context

The following diagram shows an example of an embedded subprocess that groups the service tasks used to process a sales quote.

Description of embedded-example.png follows
Description of the illustration embedded-example.png

Configure Multi-Instance Markers in Subprocesses

Multi-instance markers enable you to run a subprocess for each of the elements on a set of data. When a subprocess with a multi-instance loop marker runs, it creates a set of instances, one for each element on the set of data. You can configure the multi-instance marker to process these instances in parallel or in a sequence.

For example, you can use multi-instance markers in repetitive processes, such as creating travel requests for a group of employees, ordering office supplies for a team, and so on. Multiple instances are created, one for each employee, which are then passed through the process of individual requests being made and forwarded to the approver. These instances can be configured to run either in sequence or in parallel.

If multi-instance markers are used, an indicator for the same appears on the subprocess; two white circles indicate sequential execution, while two vertical white lines indicate parallel execution.

Indicators for multi-instance markers

To configure multi-instance markers in a subprocess:

  1. Click the subprocess.

  2. Select Properties. The Implementation pane appears.

  3. Select Generate multiple instances under Repetition Cycle.

  4. Select the way in which you want to manage your instances:

    1. In Sequence: Select to specify that the each instance must complete the subprocess before the next instance starts to run the subprocess.

    2. Parallel: Select to specify that all instances run in parallel.

  5. Specify the type of input you want to supply:

    1. Condition: If your input is not an array, then select Condition to specify the number of times to execute the sub-process.

      1. In the adjacent expression area, enter a number to specify the cardinality. You may also enter a data object or a simple expression to specify the same. To launch the Expression Editor window, click the Edit Expression button.

    2. Array: Select to enter an array of elements as input.

      1. In the input expression field, enter the array that is to be consumed by the subprocess. You can select a data object or form a simple expression using the Expression Editor window. Generally, the selected data object is a collection of items.

      2. In the output expression field, enter the array to store the result of the subprocess.

  6. Optionally, you can specify a completion condition to terminate the execution of instances.

    1. Select the Define a condition that terminates execution of subprocess instances check box..

    2. In the resulting expression field, enter a completion condition in terms of a simple expression.

Note:

  • At the subprocess level, you can add data objects (of any type) with their scope limited to an individual subprocess execution. Such data objects help you, especially in parallel execution, to keep local copies of data and merge them after all instances are executed.

  • In the XPath expression that is used to fetch data objects for each instance, make sure that the index starts from ‘1’ and not from ‘0’.

Important:

If you have a subprocess that invokes multiple instances of another process, aborting any of these child instances triggered by the parent process will abort all child instances in the same flow.

Predefined Variables

The following predefined variables are available for multi-instance subprocesses. Data communication within a multi-instance subprocess should happen using these variables.

Name Data Type Description Available for MI Array? Available for MI Condition?

loopCounter

int

The sequence number of the iteration.

Yes

Yes

numberOfInstances

int

The total number of instances.

Yes

Yes

numberOfActiveInstances

int

The total number of active instances.

Yes

Yes

numberOfCompletedInstances

int

The total number of completed instances.

Yes

Yes

numberOfTerminatedInstances

int

The total number of terminated instances.

Yes

Yes

loopDataInput

string[]

The reference of the array that is passed as input to the multi-instance subprocess.

Yes

No

inputDataItem

string

The handle to an element of the loopDataInput array passed as input to the multi-instance subprocess.

Yes

No

loopDataOutput

string[]

The reference of the array that is passed as output of the multi-instance subprocess.

Yes

No

outputDataItem

string

The handle to an element of the loopDataOutput array that is passed as output of the multi-instance subprocess

Yes

No

Note:

Transformations are not supported for predefined variables.