0
votes

I am trying to setup multi-instance subprocess, It create the correct number of process but It doesn't assign to none.

I use one java service task to get all users

public class ListUsers implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
    String group = (String) execution.getVariable("group");
    List<User> lista = execution.getEngineServices().getIdentityService().createUserQuery().memberOfGroup(group).list();
    List<String> usuarios  = new ArrayList<>();
    for (User user : lista) {
        usuarios.add(user.getId());
    }
    execution.setVariable("listaUsuarios", usuarios);
    execution.setVariable("listaUsuariosSize", usuarios.size());
}

}

My multi-instance definition

<subProcess id="subprocessConfirmacaoPresencaReuniao" name="Confirmação de Presença na Reuniao">
  <multiInstanceLoopCharacteristics isSequential="false">
    <loopDataInputRef>listaUsuarios</loopDataInputRef>
    <inputDataItem name="assignee" />
  </multiInstanceLoopCharacteristics>
  <startEvent id="starteventConfirmacaoPresencaReuniao" name="Start"></startEvent>
  <userTask id="confirmarPresenca" name="Confirmar Presença"></userTask>
</subProcess>

I have 4 users in the group, It starts 4 processes correctly but It is not assigned to the users.

Variables

NAME VALUE
group consuni
listaUsuarios [admin, cleo, fozzie, kermit]
listaUsuariosSize 4

Is there anything I am doing wrong? I am using Activiti 5.11.

1
May be I misunderstood but you trying to assign subprocess to the user? Provide code where you use "assignee" variableATMTA
@ATMTA Well I don't use this variable, Shouldn't it be automatic assignment by multiInstanceLoop? I suppose this is where I am doing wrong thendextervip
Activiti isn't so clever to assign tasks automatically, so you should explicitly set assignee using activiti:assignee="${assignee}" attribute of userTask element. By the way if you use subprocess only for multi-instance activity it would be better to move <multiInstanceLoopCharacteristics> into the <userTask> and delete subprocess elementATMTA
@ATMTA You are correct! Please post it as an answer so that I can accept it. Thank youdextervip

1 Answers

1
votes

      You should explicitly set assignee using activiti:assignee="${assignee}" attribute of userTask element. By the way if you use subprocess only for multi-instance activity it would be better to move <multiInstanceLoopCharacteristics> into the <userTask> and delete subprocess element
     Activiti user guide: Multi-instance