AnsweredAssumed Answered

How to execute more than one task in Activiti engine

Question asked by marwahussein on Apr 14, 2016
Latest reply on Apr 26, 2016 by marwahussein
Hello,
I am trying to execute a simple business process within Activiti. I have four user tasks
I defined the user tasks in the XML file as follows:


<userTask id="evaluateLoanRequest" name="Evaluate loan request" >
<userTask id="acceptloan" name="Accept Loan"/>

in the main code I tried to execute the first user with those commands  task and it was executed successfully

[java]
taskService.createTaskQuery().singleResult();
taskService.delegateTask(taskService.createTaskQuery().singleResult().getId(), "Marwa");
taskService.claim(taskService.createTaskQuery().singleResult().getId(), null);
taskService.claim(taskService.createTaskQuery().singleResult().getId(), "Alaa");
taskService.complete(taskService.createTaskQuery().singleResult().getId(), processVariables);
[/java]

when I am trying to execute the second user task it doesn't work

[java]
taskService.createTaskQuery().taskDefinitionKey("acceptloan");
[/java]

I don't know what is the problem.. any help will be appreciated

Outcomes