cancel
Showing results for 
Search instead for 
Did you mean: 

Multi instance with user task with same candidate groups

ganeshr
Champ in-the-making
Champ in-the-making
Is there a way to spawn a user task in to n user tasks using a collection variable with same candidate group and same candidate user, but with different form property values?
Let's say I have process with two user tasks. After the first task is completed then I want to spawn the next user task to n instances based on a collection list variable. Suppose that the collection variable holds two values( "form12" , "form13"). Then two user task instances should be created and the user task instance 1 should have the form property value as "form12" and the user task instance 2 should have the form property value as "form13".  And for both the user task instance the candidate users and candidate group should be the same.
Is this achievable with Activiti ? If yes, can you give us some information.





6 REPLIES 6

hari
Star Contributor
Star Contributor
Hi Ganesh,
You can try this by configuring the multi instance properties of the 2nd user task which you wanted to execute multiple times. Set the collection and element variable properties accordingly. If you want them to run sequentially then set that property to true else set it to false.

* I have done this with call activity having two processes since that was my requirement (calling sub process from a main process). Haven't actually tried it this way but looking at the options, I think it should work. Do let me know how it went. 

ganeshr
Champ in-the-making
Champ in-the-making
With multi instance option able to create parallel task multiple times, however not able to associate each parallel task with different form property value. Activiti is creating form property at process level and because of that same form property is getting created multiple times with different values in ACT_RU_VARIABLE Table. There is no way to show the task with its own form property value to User in UI application.

hari
Star Contributor
Star Contributor
Have you tried it as below ? If not, give it a try.
Have your form variables in a collection with some name like "FormKeys" and define it in the multi instance form property "Collection".
And in the element variable define "FormKey" (this is just the name of the variable which holds one element of "FormKeys")
In the main config, define Form key variable with ${FormKey}

ganeshr
Champ in-the-making
Champ in-the-making
Yes I tried that before and able to create multiple user tasks.
The problem  I'm seeing-  Activiti is creating multiple entries with "FormKey" in ACT_RU_VARIABLE Table for the same process instance id.
There is no way we can associate the "FormKey" to each user task with different values that we have given in multi instance form property "Collection".
Let's say the given collection has two elements - {"flight123", "flight234"} and I have given this collection to muli instance form property collection and defined element variable as "flightId". Now I see two entries with same field name "flightId" in ACT_RU_VARIABLE table for the same process instance id, one with value "flight123" and the other with value "flight234". 
As the TASK_ID_ Column in ACT_RU_VARIABLE table is null for both the form property entries, how can I show to user the first user task with form property value as "flight123" and the second user task with form property value as "flight234" ?

hari
Star Contributor
Star Contributor
Ganesh,
I think you will not run into the issue if you use call activity. Please have your user task which has to be executed multiple times in a different bpm and use call activity from the main bpm to invoke that.

ganeshr
Champ in-the-making
Champ in-the-making
I have some other reasons for trying it in the same process, one particular reason is for reports.
If it cannot be done then the last option I'm left with is to do it in two different processes.