AnsweredAssumed Answered

execution.setVariable() doesnt set on Parent process

Question asked by awelsh on Jan 27, 2011
Latest reply on Jan 28, 2011 by jbarrez
I have two processes, one of which is being called as a subprocess from the other.
When i call setVariable on the execution from within a java task delegate of the sub-process, It is only setting the variable locally, and not on the parent processes variables map.
This means that when I try to set a variable to signal success or failure of the sub-process to the calling process, the calling process is not seeing the variable and so is falling over with an exception.

In order to get the variable to propogate up to the parent process, I am having to cast the execution parameter from DelegateExecution to ExecutionEntity, call getSuperExecution() and then set the variables on that.

From the below source code (, it looks like setVariable should set the variable on the parent variable scope if it doesnt exist as a local variable. When I debug my code though, parentVariableScope is null, because parent is null on the ExecutionEntity instance.

My question is… is this the expected behaviour? or should a call to setVariable on a sub-process execution, propogate the variable up to the calling process?

Also, is there some element or attribute required in the callActivity xml to achieve this?

public void setVariable(String variableName, Object value) {
    if (hasVariableLocal(variableName)) {
      setVariableLocal(variableName, value);
    VariableScope parentVariableScope = getParentVariableScope();
    if (parentVariableScope!=null) {
      parentVariableScope.setVariable(variableName, value);
    createVariableLocal(variableName, value);