Hi guys,
from my listener, which is defined inside a @Singleton EJB:
public void onProcessDuringTxEvents(@Observes(during = TransactionPhase.IN_PROGRESS) final BusinessProcessEvent businessProcessEvent) {
I successfully retrieve the taskId when a “create” event occurs:
List activityIds = runtimeService.getActiveActivityIds(executionId);
The problem is that I cannot retrieve the task (nor the HistoricTaskInstance) using that activityId:
Task task = taskService.createTaskQuery().activityInstanceIdIn(activityId).singleResult();
HistoricTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).activityInstanceIdIn(activityId).list();
Can somebody explain why? How could I get it? Maybe I’m not using the right TransactionPhase? It’s strange that I can retrieve the taskId thru the runtimeService but not the associated task for that Id nor thru the taskService nor the historyService…
Thanks in advance,
Alfonso.