Get Assignee of Task

Hi Guys,

Good evening, is there anyway I can get the current Assignee of a given Task?

Use Case: My current flow has two (2) tasks, the 1st task when completed routes to the 2nd task, however there is an option to “re-investigate” therefore routing the back to the 1st task. My goal is that once option “re-investigate” was selected, the 1st task would be re-assigned to its previous assignee.

I’m seeing the method “setAssignee​(java.lang.String taskId, java.lang.String userId)” on the docs, I just don’t see a specific method for getting the userID of the Assignee for a current task.

Thank you!

Hi there!

Have you read through this post? It may lead you in the right direction.

As a last resort, you can always use a call to the REST endpoint: /engine-rest/task Will get you a list of tasks, but if you call /engine-rest/task/{id} with the task ID, you will get an object back:

{
  "id": "274b3f85-a149-11ec-9f25-42010a8e0002",
  "name": "My Task",
  "assignee": null,
  "created": "2022-03-11T14:40:10.557+0000",
  "due": null,
  "followUp": null,
  "delegationState": null,
  "description": null,
  "executionId": "274b1872-a149-11ec-9f25-42010a8e0002",
  "owner": null,
  "parentTaskId": null,
  "priority": 50,
  "processDefinitionId": "MyFormForm:2:40c847df-a147-11ec-9f25-42010a8e0002",
  "processInstanceId": "274b1872-a149-11ec-9f25-42010a8e0002",
  "taskDefinitionKey": "Activity_0miveyp",
  "caseExecutionId": null,
  "caseInstanceId": null,
  "caseDefinitionId": null,
  "suspended": false,
  "formKey": null,
  "tenantId": null
}

As you can see in that object there is an assignee field.