AnsweredAssumed Answered

Unable to acces task list from DelegateExecution.getEngineServices()

Question asked by cnirparis on Jun 13, 2014
Latest reply on Jun 27, 2014 by cnirparis
Hello everyone.

I have a serviceTask with a java class which launches a class

<serviceTask id="Initialisation" name="Initialisation" activiti:class="acoss.activiti.DelegateInitialisation"></serviceTask>


The class itself implements JavaDelegate like this

public class DelegateInitialisation implements JavaDelegate
{
   @Override
   public void execute(DelegateExecution de) throws Exception
   {
                String processId = de.getProcessInstanceId();
      TaskService tkService = de.getEngineServices().getTaskService();
                List<Task> ltasks = tkService.createTaskQuery().processInstanceId(processId).list();
                for (Task task : ltasks)
                {
                        System.out.println(task.getId());
                }
       }
}


It gives me an empty task list. It seems that the processId I get is not the "real" processInstanceId.
So I cannot get the TaskService, runtimeService, etc.
Thank very much you if you see a solution.


      

Outcomes