About this task
You can configure activity instances in multi-instance loops
so that each instance corresponds to one specific item in a list.
For example, if you have five instances of an activity and five orders
in a list, you might want to associate each instance with an order
in the list.
To set up the activity instance-item association,
the following key settings are required:
- As a prerequisite, you must already have defined a private variable
that holds the list of items that you want to iterate through, for
example, tw.local.ListofItems. This variable is
used in the built-in tw.local.ListofItems.listLength JavaScript
function, where .listLength calculates the length
of the item list.
- You associate each activity instance with a specific item in the
list by using the tw.local.ListofItems[tw.system.step.counter] JavaScript,
where [tw.system.step.counter] specifies which item
to be retrieved from the list.