cancel
Showing results for 
Search instead for 
Did you mean: 

Question about execution local variables

ghasemi
Champ in-the-making
Champ in-the-making

Assuming I have a process like this:

process

Both sub processes have parallel cardinality. I wanted to set an execution local variable in the outer script task and be able to get that variable in the inner script task; so that every inner sub process would have access to the variable from their respective parent sub process. But this is not so simple as the outer script task would be executed in an execution which is not the ancestor(eventual parent) of the inner script task. This is because activiti creates a separate execution for each sub process instance and then creates a child execution which supposedly executes everything inside that sub process instance(same goes for the main process instance as well; it creates a child execution and executes everything in that execution).

This problem can be solved by setting local variables in the parent execution of the current execution. But I am not certain about the possible side effects of this solution if we make it a convention to ALWAYS set local variables in the parent execution; because I don't know the answer to these questions:

  1. Why do process instances and sub process instances create a 'child execution' and execute everything in the 'child execution' instead of executing everything in their own execution and not creating any 'child execution'?
  2. Why are sub process instances executed in an execution that is the sibling of the 'child execution' instead of being executed in an execution which is the child of the 'child execution' so that they could inherit its variables?
0 REPLIES 0