AnsweredAssumed Answered

[Java] Get task id after workflow start

Question asked by axl8713 on Aug 2, 2013
Latest reply on Apr 11, 2014 by sawa
Hi everybody!

I'm trying to develop a Java backed webscript that starts a new workflow and redirects the user to the 'task-edit' page for the first 'userTask'.

In the method
executeImpl
, I start a new workflow and subsequently end the start task. Now the active task should be the one following the start task, so I query for it:

WorkflowTaskQuery query = new WorkflowTaskQuery();
query.setActive(null);
query.setWorkflowDefinitionName("activiti$cdGroupMeeting");
query.setTaskState(WorkflowTaskState.IN_PROGRESS);
List<WorkflowTask> tasks = serviceRegistry.getWorkflowService().queryTasks(query, true);

The list
tasks
is empty. What's wrong?

Moreover, if I redirect the user on another webscript and execute the query from there, it works.

Someone could explain me this behaviour? There's another way to accomplish my need?

Thanks,
Alessandro

Outcomes