AnsweredAssumed Answered

First HumanTask in a sub-process called by callActivity

Question asked by ayzegul on Jan 3, 2012
Hi,

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(GetExecutionVariableCmd.java:52)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:97)

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.)

Thanks,
Aysegul.

Outcomes