AnsweredAssumed Answered

Dynamically assigning task to users

Question asked by sambit on Jun 24, 2013
Latest reply on Jun 25, 2013 by sambit
Activiti Version: 5.12.

We have a need, for an admin to view all user tasks under a bpmn model file and assign each task to suitable user. For this we have created an admin task. Please note, when admin person assigns tasks to users, tasks are not yet executed(i.e kind of future tasks). After admin complete his job, each user should login to their UI screen and compelte task. We have our own UI framework for Admin and user pages.

Q: how to allow the admin person to assign the future tasks ?
Following code snippet is used to query all tasks
      String processDefinitionID = rtService
      .createProcessInstanceQuery().list().get(0).getProcessDefinitionId();
      BpmnModel bpmnmodel = reposService.getBpmnModel(processDefinitionID);
      List<Process> processes = bpmnmodel.getProcesses();
      for(Process indivProcess:processes){
         List<UserTask> userTasks = indivProcess.findFlowElementsOfType(UserTask.class);
         for(UserTask userTask:userTasks){
            System.out.println("Task=" + userTask.getName() + "; TaskAssignee=" + userTask.getAssignee()+"\n");            
         }
      }

however    userTask.setAssignee(userName); does not see to work.

Kindly suggest.

Thanks
Sambit

Outcomes