And the owner was replaced with a varaible that mean the owner of this user task is replaced the variable value at the process instance started.
Let us assume the user task instance was created and the variable `applicantId’ is 1.
But now for some reason I need to change the user task instance owner to 2.
This snippet assumes that the JavaDelegate instance runs in the same process instance the task to be modified has been created from. And additionally, that there is only one active task active at the moment.
I have tried to find the task with
Task task = ProcessEngines.getDefaultProcessEngine().getTaskService().createTaskQuery().processInstanceId(execution.getProcessInstanceId()).singleResult();
and with
TaskService taskService = execution.getProcessEngineServices().getTaskService();
task = taskService.createTaskQuery().processInstanceId(execution.getProcessInstanceId()).singleResult();