AnsweredAssumed Answered

Exclusive Gateway and 'Error while evaluating expression' errors

Question asked by vve76 on Mar 2, 2015
Latest reply on Jul 24, 2015 by shekhar.shaw
Hi!
I use Activiti 5.16.4. and try to  execute simple BP. There are two errors presents:
1. If I chose on User task1 form  at "accept1" field "Accept" chose, I follow  to the UserTask2 and it correct. If I choose reject - I follow to the ScriptTask and this correct too. But if I chose Reject, I follow to the ScriptTask instead of usertask_error. How I can make it correctly?
2.  On the UserTask2 I have form field par_1:

    <userTask id="usertask2" name="User Task2" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="par_1" name="param1" type="string" expression="${par1}"></activiti:formProperty>
      </extensionElements>
    </userTask>

It's receive content from field par1 of the UserTask1 correctly but when I try to finish task I get error message "Error while evaluating expression: ${par1}" and cannot continue executing BP. please, help me receive parameter correctly.
Cod is below:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="VVE_1" name="VVE_1" isExecutable="true">
    <startEvent id="startevent1" name="Start">
      <extensionElements>
        <activiti:formProperty id="name1" name="name1" type="string"></activiti:formProperty>
        <activiti:formProperty id="name2" name="name2" type="string"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <userTask id="usertask1" name="User Task1" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="accept1" name="accept1" type="enum" required="true">
          <activiti:value id="true" name="Accept"></activiti:value>
          <activiti:value id="false" name="Reject"></activiti:value>
          <activiti:value id="error" name="Error"></activiti:value>
        </activiti:formProperty>
        <activiti:formProperty id="productName" name="Product Name - display Name" type="string"></activiti:formProperty>
        <activiti:formProperty id="par1" name="par1" type="string"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>out:println"\n===Order rejected due stock issues ==="</script>
    </scriptTask>
    <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="scripttask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==false}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="usertask2" name="User Task2" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="par_1" name="param1" type="string" expression="${par1}"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="usertask2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==true}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow5" sourceRef="usertask2" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow6" sourceRef="scripttask1" targetRef="exclusivegateway2"></sequenceFlow>
    <userTask id="usertask3" name="User Task3" activiti:assignee="kermit"></userTask>
    <sequenceFlow id="flow7" sourceRef="exclusivegateway2" targetRef="usertask3"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow8" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
    <userTask id="usertask_error" name="User Task-Error"></userTask>
    <sequenceFlow id="flow9" sourceRef="exclusivegateway1" targetRef="usertask_error">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${accept1==error}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow10" sourceRef="usertask_error" targetRef="exclusivegateway2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_VVE_1">
    <bpmndi:BPMNPlane bpmnElement="VVE_1" id="BPMNPlane_VVE_1">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="60.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="140.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="290.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55.0" width="105.0" x="340.0" y="40.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55.0" width="105.0" x="341.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="560.0" y="143.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55.0" width="105.0" x="645.0" y="136.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="700.0" y="300.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask_error" id="BPMNShape_usertask_error">
        <omgdc:Bounds height="55.0" width="105.0" x="332.0" y="400.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="95.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="140.0" y="177.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="245.0" y="177.0"></omgdi:waypoint>
        <omgdi:waypoint x="290.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="310.0" y="158.0"></omgdi:waypoint>
        <omgdi:waypoint x="392.0" y="95.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="310.0" y="198.0"></omgdi:waypoint>
        <omgdi:waypoint x="393.0" y="280.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="393.0" y="280.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="183.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="445.0" y="67.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="67.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="143.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="600.0" y="163.0"></omgdi:waypoint>
        <omgdi:waypoint x="645.0" y="163.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="697.0" y="191.0"></omgdi:waypoint>
        <omgdi:waypoint x="717.0" y="300.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="310.0" y="198.0"></omgdi:waypoint>
        <omgdi:waypoint x="384.0" y="400.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="437.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="183.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Outcomes