How to modify collection on multi-instance.

cancel
Showing results for 
Search instead for 
Did you mean: 
Member II

How to modify collection on multi-instance.

Hi Team, 

We are creating POC for a project where we will have 4 stages of approval. Let's say the 4 stages are

1. Accountant

2. Manager

3. Owner

4. Delivery Head

A process has started and right now the user task i.e. approval is at the Accountant level. The multi-instance will loop in a collection returned from Java Service class. While the loop is running for that particular set of users, I want to push a new user in it. I'm able to add more users in the collections of manager, owner and Delivery Head because the approval stage is on Accountant Level and the collection call for those approvers is not performed yet.

Is there a way to add new users in the current running loop collection i.e. of Accountant collection? If yes, Please suggest a way, preferably using Java. 

3 Replies
Senior Member

Re: How to modify collection on multi-instance.

You can use a boundary signal event on your multi-instance use task/sub-process, which will cancel all the currently running tasks and create new tasks for the updated collection.

below diagram might help

enter image description here

Note: you will have to call the signal (from your code) after you have updated your collection with runtimeService.signalEventReceived("yourSignalId", "yourProcessInstanceID");

Regards,
Abbas
Member II

Re: How to modify collection on multi-instance.

We don't want to replace it with the new collection, we want to update it and continue. E.g. I want to add a new resource into the collection or if we want to change the sequence of items in the collection.

Senior Member

Re: How to modify collection on multi-instance.

i don't think its possible to "update" values on the fly. the execution will simply replace your old list with a new one. anyways you won't be able to refer to the old list.

Regards,
Abbas