AnsweredAssumed Answered

First HumanTask in a sub-process called by callActivity

Question asked by ayzegul on Jan 3, 2012

I have two separate processes. One of them is calling the other one by a callActivity. Now, in the first step of the sub-process there is a HumanTask. In this HumanTask I have a taskListener where I'm trying to get values of some process variables. If I try to get the variable by calling

ProcessEngine.getRuntimeService().getVariable(processInstanceId, varName)

then I get an Exception like this:

org.activiti.engine.ActivitiException: execution 3414 doesn't exist
   at org.activiti.engine.impl.cmd.GetExecutionVariableCmd.execute(
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(

I get that my transaction is not committed yet, so the new started process's database record (in execution table) is not committed yet. But if I start the very same sub-process through RuntimeService.startProcessInstanceByKey, I can get the same variable using the same code (execution record exists in database). Is there a way to force commit the transaction once the sub-process is initiated? (I've tried marking callActivity activiti:async, didn't work.)