cancel
Showing results for 
Search instead for 
Did you mean: 

Create User Multi Instance Task Programatically

edufrazao
Champ on-the-rise
Champ on-the-rise

Hi Guys.

I'm working in a flow when I open multi instance user tasks, and sometimes, this user tasks have a previsible count. But sometimes, I have the need to add more instances of this tasks and wait their conclusion like any other user task. Its possible to do that?

There is any doc/example that you can share?

4 REPLIES 4

cjose
Elite Collaborator
Elite Collaborator

It is possible to use expressions (dynamic calculation for each process instance) to configure multi instance cardinality. Please refer Activiti User Guide Multi Instance for more details

Cheers,

Ciju

gdharley
Elite Collaborator
Elite Collaborator

My favorite way of implementing Multi instance loops is to create the instances over a collection.

That way, there are no hard coded limits for the number of instances and you can add your own custom completion conditions.

A typical example of this is an approval task where 3 of the X assignees need to approve to move forward.

What you want is to exit as soon as 3 people approve. Use the early completion expression to implement this and havr the multi instance implemented over a list of "approvers".

Hope this helps,
greg

edufrazao
Champ on-the-rise
Champ on-the-rise

Hi Guys, thank you for answer..

I already use the "usual" cardinality approach, with a collection, to create the "initial" and "previsible" tasks.

But in my use case, when there is still opened tasks instances, I may need to add another ones, programatically, based on runtime conditions that does not exists in the moment on the flow execution that creates the firts tasks. Is it even possible?

Have you resolved your problem? I've the same situation and I'm searching for a solution too