AnsweredAssumed Answered

Task query by execution id returns null (for a single process)

Question asked by felipe1 on Aug 29, 2014
Latest reply on Sep 1, 2014 by felipe1
I'm using a class that extends <b>JavaDelegate</b> in a service task, and I need to get the current assignee from within that JavaDelegate.

So I created the following utils method that returns the current task:

   protected Task obtemTarefa(DelegateExecution execution) {
      return execution.getEngineServices().getTaskService().createTaskQuery().executionId(execution.getId()).singleResult();

and I call it from my JavaDelegate where I call <b>task.getAssignee()</b>. It works great on 4 different processes. However it fails on a 5th process, because singleResult() always returns <b>null</b>.

I have debugged that code for quite a while, and, at that point, <b>execution</b> is a valid object, and it has values for <b>id</b>, <b>processDefinitionId</b>, and many others. I have queried the ACT_RU_EXECUTION and find out a valid execution with the same id…

Any clues?