Configure a Multi-instance Activity

You can configure an activity as a multi-instance activity, so that you can run multiple unique instances of the same activity sequentially or in parallel.

The following system activities can be configured as multi-instance activities:
  • Call
  • Service
  • Subprocess
  • Integration
  1. Open a structured process where you want to add a repeatable or multi-instance activity.
  2. In the process editor, expand System in the Activity palette, and drag and drop an activity (Call, Service, Subprocess, Integration) that can be configured as a multi instance activity onto the process flow.
    Notice how a multi-instance icon Multi-instance icon appears on the right side of the process editor. The icon is displayed only for a call, service, subprocess or integration activity, indicating that you can configure such an activity as multi-instance.
  3. If required, complete the implementation details for the activity.
    1. Double click the activity, or select the activity and click menu icon, and then select Open Properties to open the activity's properties pane.
    2. In the activity's properties pane, under Implementation:
      • For a call activity, select the process you want to call from the Process field.
      • For a service or integration activity, enter the connector details by selecting the service in the Service field, the resource in the Resource field, and an operation in the Operation field.
  4. Click the Multi-instance icon Multi-instance icon.

    The Multi-instance properties pane appears. By default, Do not repeat is selected under Repetition Cycle.

  5. Select the Generate multiple instance button. A number of fields to specify and manage your multi-instance activity appears.
    1. Define how you want to manage your instance. If you want the instances to occur sequentially, select Sequential. If you want to see all the instances at the same time, select Parallel.
      Notice that the icon for the multi-instance activity, in the process flow diagram on canvas, changes according to your selection - sequential or parallel.
    2. Specify how you want to create the instances – with a condition or with an array. Depending on the selection, related fields appear.

      For example, if you select Array, a field appears to enter the array. You can use the in-built expression builder to specify the array. If you select Condition, a field appears to specify the number of instances to be created.

      See Work with Expressions.

    3. If you want to terminate the activity execution with a condition, select the checkbox for it, and specify the condition in the Condition field using the in-built expression editor. Otherwise, de-select the checkbox.
    4. Close the multi-instance properties pane to save the configurations.
  6. Configure data association with the variables created for the multi-instance activity.

    In the Data Association window, notice a new container Activity Loop under Data Objects. Expand the Activity Loop container to see all the multi-instance related variables and use them for data association.

    Predefined Variables

    The following predefined variables are available for multi-instance activities.

    Name Data Type Description Available for MI Array? Available for MI Condition?
    loopCounter integer The sequence number of the iteration. Yes Yes
    nrOfInstances integer The total number of instances. Yes Yes
    nrOfActiveInstances integer The total number of active instances. Yes Yes
    nrOfCompletedInstances integer The total number of completed instances. Yes Yes
    inputDataItem Same as input array element type.

    Holds a reference to the input array content on the current iteration.

    For example, if the loopCounter for the iteration is 2, inputDataItem will contain the second element of the input array.

    Yes No
    outputDataItem Same as output array element type.

    Holds a reference to the output array content on the current iteration.

    For example, if the loopCounter for the iteration is 2, outputDataItem will contain the second element of the output array.

    Yes No