AnsweredAssumed Answered

When startProcessInstanceByKey gives the instance back ?

Question asked by vire7777 on Dec 5, 2012
Latest reply on Dec 7, 2012 by ronald.van.kuijk
Hi all :)

A little question but SO important for me.
I ve created a workflow instance launcher with the code :

ProcessInstance instance = runtimeService.startProcessInstanceByKey(processKey);

But something strange about that !
In my workflow, i have two javaservicetask then a human task and i ve seen that the code above gives me the instance back ONLY when it reaches the human task.

In the documentation, there s something about that :

It's important to note that the Activiti engine will continue process execution steps until it reaches a wait state, such as the user task. At such a wait state, the current state of the process instance is stored in the database. It remains in that state until a user decides to complete its task. At that point, the engine will continue until it reaches a new wait state or the end of the process. When the engine reboots or crashes in the meantime, the state of the process is safe and well in the database.

But could i do something for having it directly after the instance launch because i need it before the instance reaches the first javaservice task.

Thanks for your time and answers