'How to make pass variables through CallActivity in Activiti correctly?
I'm calling sub process from main process. I'm using Alfresco Activiti 7.1.0.M3.1.
Sub process starting without a problem, but when I'm trying to get variables in it with execution.getVariables()
or
execution.getVariable("par1")
I get nothing. (empty map or null)
This is the way I'm setting variable in main process:
<callActivity id="callactivity1" name="Call activity" calledElement="myProcess2" >
<extensionElements>
<activiti:in source="var1i" target="par1"></activiti:in>
<activiti:out source="par1" target="var1i"></activiti:out>
<activiti:executionListener event="start" delegateExpression="${executionListener}"></activiti:executionListener>
<activiti:executionListener event="end" delegateExpression="${executionListener}"></activiti:executionListener>
</extensionElements>
</callActivity>
I found a flag in callActivity: callActivity.isInheritVariables()
with this flag true (it can't be set from Eclipse, only from java), then variables passing to sub process but with the same names as in main process (var1i). And when I change this variable in sub process, it doesn't return to main.
I read carefully docs: https://www.activiti.org/userguide/#bpmnCallActivity and doing exactly as it written in it. It doesn't seemed to work.
I see the way to write own implementation CallActivityBehavior and to set it to engine, and it will work, but in docs it should work from default configuration. What I missing?
Solution 1:[1]
First you have tried to reach root process instance with;
ExecutionEntity thisEntity = (ExecutionEntity) execution;
ExecutionEntity pi= (ExecutionEntityImpl) thisEntity.getRootProcessInstance()
Please take a look on this link below,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arjun |