AnsweredAssumed Answered

How to reassign a user task

Question asked by shiva.arunachala on Mar 26, 2015
Latest reply on Apr 7, 2015 by jbarrez
Hi,
I want to reassign a task a different user. Since Explorer has the "reassign" option,  i searched the code for explorer and found the below code which i believe does the reassignment:
<blockcode>
// Update assignee
           String selectedUser = involvePeoplePopupWindow.getSelectedUserId();
           String originAssignee = task.getAssignee();
           task.setAssignee(selectedUser);
           if (selectedUser != null) {
             ProcessEngines.getDefaultProcessEngine().getTaskService().setAssignee(task.getId(), selectedUser);
           } else if (originAssignee != null) {
             ProcessEngines.getDefaultProcessEngine().getTaskService().deleteUserIdentityLink(task.getId(), originAssignee, IdentityLinkType.ASSIGNEE);
           } else {
             return;
           }
</blockcode>

Now i understand 
 task.setAssignee(selectedUser);
.
But why is a call made on taskService also? is the above call not sufficient.
ProcessEngines.getDefaultProcessEngine().getTaskService().setAssignee(task.getId(), selectedUser);


Second question: can the same be effected through the usage of below methods only on taskService?
TaskService.addUserIdentityLink(String, String, String)
TaskService.addGroupIdentityLink(String, String, String)



Outcomes