Call Activities

A call activity (aka reusable subprocess) allows to call/invoke another workflow as part of this workflow. It is similar to an embedded subprocess but the workflow is externalized (i.e. stored as separated BPMN) and can be invoked by different workflows.

call-activity

When a call activity is entered then a new workflow instance of the referenced workflow is created. The new workflow instance gets activated at the none start event. The workflow can have start events of other types but they are ignored.

When the created workflow instance is completed then the call activity is left and the outgoing sequence flow is taken.

Defining the Called Workflow

A call activity must define the BPMN process id of the called workflow either as processId or as processIdExpression. The processId defines the BPMN process id statically on the design time of the workflow.

The processIdExpression instead defines the variable which holds the BPMN process id. The variable is read from the workflow instance on activating the call activity. It must be a string (e.g. child-process-id).

The new instance of the defined workflow will be created of its latest version - at the point when the call activity is activated.

Boundary Events

call-activity-boundary-event

Interrupting and non-interrupting boundary events can be attached to a call activity.

When an interrupting boundary event is triggered then the call activity and the created workflow instance are terminated. The variables of the created workflow instance are not propagated to the call activity.

When an non-interrupting boundary event is triggered then the created workflow instance is not affected. The activities at the outgoing path have no access to the variables of the created workflow instance since they are bounded to the other workflow instance.

Variable Mappings

When the call activity is activated then all variables of the call activity scope are copied to the created workflow instance.

Input mappings can be used to create new local variables in the scope of the call activity. These variables are also copied to the created workflow instance.

By default, all variables of the created workflow instance are propagated to the call activity. This behavior can be customized by defining output mappings at the call activity. The output mappings are applied on completing the call activity.

Additional Resources

XML representation

A call activity with static process id:

<bpmn:callActivity id="task-A" name="A">
  <bpmn:extensionElements>
    <zeebe:calledElement processId="child-process-id" />
  </bpmn:extensionElements>
</bpmn:callActivity>

Using the BPMN modeler

Adding a call activity with static process id:

call-activity

Workflow Lifecycle

Workflow instance records of a call activity:

Intent Element Id Element Type
ELEMENT_ACTIVATING task-a CALL_ACTIVITY
ELEMENT_ACTIVATED task-a CALL_ACTIVITY
ELEMENT_ACTIVATING child-process-id PROCESS
ELEMENT_ACTIVATED child-process-id PROCESS
... ... ...
ELEMENT_COMPLETED child-process-id PROCESS
ELEMENT_COMPLETING task-a CALL_ACTIVITY
ELEMENT_COMPLETED task-a CALL_ACTIVITY

The workflow instance records of the created workflow instance have a reference to its parent workflow instance (parentWorkflowInstanceKey) and the element instance of the call activity (parentElementInstanceKey).

References: