AnsweredAssumed Answered

How to get current tasks in ActivitiEventListener (TASK_CREATED event)

Question asked by marian88 on Jul 30, 2014
Latest reply on Jul 30, 2014 by marian88
Hi,

I'd like to get task name when a TASK_CREATED event occured.

I have a class that implements ActivitiEventListener and I am trying to get the task name on the event TASK_CREATED.

I do this and currentTasks is null : 

case TASK_CREATED:
            System.out.println("task created");
            List<Task> currentTasks = event.getEngineServices().getTaskService().createTaskQuery().processInstanceId(event.getProcessInstanceId()).list();
            for (Task task : currentTasks) {
            System.out.println("task name: "+task.getName());
         }
            break;


The event contains a TaskEntity instance that doesn't have all fields filled in.

Thank you!

Outcomes