Hello Joni,
When you deal with multi-instances initiated with a "Multiple" business object, the context of the UserTask contains information about the multi-instance.
I have designed a process with a human task multi-instanciated by providing a Multiple<com.company.model.MultiInstanceItem> containing 3 elements.
Note: the MultiInstanceItem is the name of the business object I've created but it can be anything that matches your business requirements.
When executing the process, I get 3 UserTasks (1 per item). In the form design of the multi-instanciated human task, I extract from the context (variable auto generated when creating the form from Bonita Studio also accessible via ../API/bpm/userTask/{{taskId}}/context) the information related to the multi-instance:
"items_ref": { "name": "items", "type": "com.company.model.MultiInstanceItem", "link": "API/bdm/businessData/com.company.model.MultiInstanceItem/findByIds?ids=1,2,3", "storageIds": [ 1, 2, 3 ], "storageIds_string": [ "1", "2", "3" ] },
"multiInstanceIterator_ref": { "name": "multiInstanceIterator", "type": "com.company.model.Item", "link": "API/bdm/businessData/com.company.model.Item/3", "storageId": 3, "storageId_string": "3" }
As you can see there are 2 pieces of information that are useful to me:
- items_ref is the reference to the business data (multiple) that has been used to create the multi-instance. We can see that it contains 3 elements
- multiInstanceIterator_ref is the reference to the Iterator within the multi-instance. Each human task get a different value. In the example above you have the Iterator value for the 3rd human task. By extrapolation you can understand that the task 1 get the iterator pointing to the 1st Item, and the task 2 gets the iterator pointing to the 2nd Item.
So using the multiInstanceIterator_ref in your form, you can then display the right Item to your user depending on the task context.
I hope this is clear enough, let me know if you need more details.
Captain Bonita