How do I get the assignee of user task

I want get the assignee of user task using java. How do we do that?


You can use org.camunda.bpm.engine.TaskService to get assignee of task and other details.
String taskId = “xyz”;
String assignee
= taskService.createTaskQuery().taskId(taskId ).initializeFormKeys().singleResult().getAssignee()


Thanks for your response. But if a task has multiple user, then how would we do that?

You can try something like this.

List identities = taskService.getIdentityLinksForTask(taskId);
for(IdentityLink link : identities)
String id = link.getGroupId();
if(id == null)
id = link.getUserId();

1 Like