AnsweredAssumed Answered

callActivity doesn't work when calling another xml

Question asked by clever@email.com on Mar 11, 2014
Latest reply on Mar 12, 2014 by trademak
HI can someone please explain how callActivity works calling another xml process or tell me what's wrong with this:

I'm trying to put a subprocess in its own file to make it 1) reusable and 2) make the main xml smaller cause it is getting big. so i create a simple subprocess that if called within the same xml works ok, but once i create a callActivity and i move the subprocess to another file it doesnt work anymore.

This works:


mainprocess.bpmn20.xml

<serviceTask id="handleProcess" name="Handle process" activiti:class="com.package.activiti.ActivitiServiceProcess" />
<sequenceFlow id="flow1" sourceRef="handleProcess" targetRef="handleSubProcess" />
<sequenceFlow id="flow2" sourceRef="handleSubProcess" targetRef="end" />
<subProcess id="handleSubProcess" name="Handle Sub-Process">
   <startEvent id="handleSubProcessStart" />
   <exclusiveGateway id="makeDecision" name="Is this true" />
   <serviceTask id="create_process" name="Create process"   activiti:class="com.package.activiti.ActivitiServiceProcess" />
   <receiveTask id="complete_process" name="Complete process" />
   <exclusiveGateway id="makeDecisionEnd" name="END is this true" />
   <endEvent id="handleSubProcessEnd" />
   <sequenceFlow id="flow3" sourceRef="handleSubProcessStart"   targetRef="makeDecision" />
   <sequenceFlow id="flow4" sourceRef="makeDecision" targetRef="create_process">
      <conditionExpression>${service.evaluate(execution, "isThisTrue")}</conditionExpression>
   </sequenceFlow>
   <sequenceFlow id="flow5" sourceRef="create_process" targetRef="complete_process" />
   <sequenceFlow id="flow6" sourceRef="complete_process" targetRef="makeDecisionEnd" />
</subProcess>



IF i change this to look as follows it doesn't work anymore:

mainprocess.bpmn20.xml

<serviceTask id="handleProcess" name="Handle process" activiti:class="com.package.activiti.ActivitiServiceProcess" />
<sequenceFlow id="flow1" sourceRef="handleProcess" targetRef="handleSubProcessCall" />
<callActivity id="handleSubProcessCall" name="Handle Sub-Process" calledElement="handleSubProcess" />
<sequenceFlow id="flowSD3" sourceRef="handleSubProcessCall" targetRef="end" />


subprocess.bpmn20.xml

<process id="handleSubProcess" name="Handle Sub-Process">
   <startEvent id="start" />
      <exclusiveGateway id="makeDecision" name="Is this true" />
      <serviceTask id="create_process" name="Create process" activiti:class="com.package.activiti.ActivitiServiceProcess" />
      <receiveTask id="complete_process" name="Complete process" />
      <exclusiveGateway id="makeDecisionEnd" name="END is this true" />
   <endEvent id="end" />
   <sequenceFlow id="flow3" sourceRef="handleSubProcessStart"   targetRef="makeDecision" />
   <sequenceFlow id="flow4" sourceRef="makeDecision" targetRef="create_process">
      <conditionExpression>${service.evaluate(execution, "isThisTrue")}</conditionExpression>
   </sequenceFlow>
   <sequenceFlow id="flow5" sourceRef="create_process" targetRef="complete_process" />
   <sequenceFlow id="flow6" sourceRef="complete_process" targetRef="makeDecisionEnd" />
</process>



can someone please tell me what's wrong with it or how to make this work? there is no concrete example in the user guide about calling a different XML and my code was based on the only example i was able to find: http://forums.activiti.org/content/subprocess-definition-separate-xml
i've moved the code exactly to the other file as you can see and i've just made the call to it from the main.

i get a runtime exception:
org.activiti.engine.ActivitiException: Error while evalutaing expression
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:59)
   at org.activiti.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:37)
   at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:63)
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:36)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)

Outcomes