cancel
Showing results for 
Search instead for 
Did you mean: 

using multi instance...

sojasoja
Champ in-the-making
Champ in-the-making
hi,

i have a user task which is needed to be assigned to all members of a group, so i should use multi instance , but i couldn't define collection variable properly in the designer in Eclipse, can anyone help me?! it always says "[variable name]" is not a collection!!!
how should i define this collection in Eclipse?!

i tried to create a script task , define a List<String> … but it didn't work,
use groovy and define: def Lname=  ["user1", "user2"]   it also didn't work…
define a new form variable Listname with value of {"user1" , "user2"} , ["user1" , "user2"] …. it didn't work too…

please help me Smiley Wink
5 REPLIES 5

trademak
Star Contributor
Star Contributor
Hi,

Did you try to create a List in a Java service task?

Best regards,

sojasoja
Champ in-the-making
Champ in-the-making
oOps… thanks alot , it solved my problem.. Smiley Happy

nitroin
Champ in-the-making
Champ in-the-making
Hi soja,

Can you explain how you define the list in the Java service task?

I'm having the same problem here.

sojasoja
Champ in-the-making
Champ in-the-making
hi nitroin,

define a java service task , and assign a java class to this task, with the below code:



package makeMYusers;

import java.util.ArrayList;
import java.util.Collection;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class mylist  implements JavaDelegate {

@Override
   public void execute(DelegateExecution execution) throws Exception {
     Collection<String> USlistName = new ArrayList<String>();
     USlistName.add("name1");
     USlistName.add("name2");
     execution.setVariable("nameList", USlistName);
   
  }
 
}


"nameList" is the variable , that you should define it , and use it in the multi instance section of the task rpopertise, which you want to run in multi instance mode.  Smiley Wink

nitroin
Champ in-the-making
Champ in-the-making
Thanks!  Smiley Happy