Create User Multi Instance Task Programatically

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

Create User Multi Instance Task Programatically

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?

3 Replies
Highlighted
Senior Member II

Re: Create User Multi Instance Task Programatically

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

Highlighted
Intermediate

Re: Create User Multi Instance Task Programatically

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

Highlighted
Member II

Re: Create User Multi Instance Task Programatically

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?