IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Modeling processes > Create a business process definition (BPD) > Implementing activities

Create loops

When you want the runtime task that results from an activity to be run more than once, you can create a loop. You can create simple loops and multi-instance loops in IBM BPM.

IBM BPM provides several ways to create and implement loops.

For example, you can include a script component in a service that iteratively processes records that you retrieve from a database until all records are processed. Since you can include JavaScript throughout your implementations, you can easily develop the logic required to repeat an action until a certain condition is true.

In addition to implementing loops with scripts, the activities that you add to your BPDs can be configured for simple and multi-instance looping, as described in the following table. When you want the runtime task that results from an activity to be run more than once, you can configure looping behavior for that activity.

Loop types available for looping configuration
Loop type Description
Simple loop When you model an activity with simple looping, the required number of instances is dynamically created, up to the loop maximum value that you specify. A simple-looping activity is run sequentially until the last instance of the activity is run. When you run an activity configured for simple looping, a single token is generated and used for each instance of the activity, which, in effect, recycles the runtime task.
Multi-instance loop Multi-instance looping dynamically runs multiple unique instances of the same activity sequentially or in parallel. When you run an activity configured for multi-instance looping, a unique token is created for each instance of the activity. (For more information about tokens, see Inspector reference.)

Implementing activities