cancel
Showing results for 
Search instead for 
Did you mean: 

use a passed variable from a parent process in a subprocess javascript

malekobaid
Champ in-the-making
Champ in-the-making
Hallo There,

I hava a process_parent that calls a sub_process, passing variables under the callActivity node as:
<blockcode>
      <extensionElements>
        <activiti:in source="_inLong" target="_inLong"></activiti:in>
        <activiti:in source="_inString" target="_inString"></activiti:in>
        <activitiSmiley Surprisedut source="_counter" target="_counter"></activitiSmiley Surprisedut>
      </extensionElements>
    </callActivity>
</blockcode>

I have a scriptTask in the sub_process that should does the following:
<blockcode>
<scriptTask id="scripttask31" name="Increment inLong Script 1" scriptFormat="javascript">
      <script><![CDATA[_inLong++;
      java.lang.System.out.println("_inLong " + _inLong);]]></script>
         </scriptTask>
</blockcode>
But this does not increment the _inLong variable at all, it stays 0, as specified in the parent process.
Appreciate any help.

p.s. I am using the latest engine, under tomcat 7, and java 7.
1 REPLY 1

malekobaid
Champ in-the-making
Champ in-the-making
Update:
I added
<blockcode>
execution.setVariable("_inLong", _inLong);
</blockcode>
In the <script> and it is much better, it works.

But apparently, the condition I do later on this value does not work.

i.e.:

<blockcode>
<sequenceFlow id="flow1" sourceRef="exclusivegateway4" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${_inLong >= _counter}]]></conditionExpression>
    </sequenceFlow>
</blockcode>
does not work, does anyone has an idea?

thanks,