Condition evaluation on Exclusive Gateway

Hi,

I’ve a process where I check where a task is approved or rejected. For this, I’ve added two radio buttons in a task form. when I select one of the radio button and click on complete button.

I get error stating

24-Jan-2017 11:14:44.070 SEVERE [http-nio-8080-exec-107] org.camunda.commons.logging.BaseLogger.logError ENGINE-16006 BPMN Stack Trace:
ExclusiveGateway_1cl0snn (activity-leave, ProcessInstance[1ab7a20d-e1f8-11e6-92fc-e4b318cb12e5], pa=Loan Approval App)
ExclusiveGateway_1cl0snn
^
|
Task_1n0xwel

24-Jan-2017 11:14:44.073 SEVERE [http-nio-8080-exec-107] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: condition expression returns non-Boolean: result has class java.lang.String and not java.lang.Boolean
org.camunda.bpm.engine.ProcessEngineException: condition expression returns non-Boolean: result has class java.lang.String and not java.lang.Boolean
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Implementation
Form:

    <div class="form-group">
        <div class="col-md-10 col-md-offset-2">
          <div class="radiobutton">
            <label>
              <input cam-variable-name="approved"
                     cam-variable-type="String"
                     type="radio"
                     name="approved"
                     class="form-control" value="APPROVED"/>
              Approved
            </label>
              <label>
                  <input cam-variable-name="rejected"
                         cam-variable-type="String"
                         type="radio"
                         name="rejected"
                         class="form-control" value="REJECTED"/>
                  Rejected
              </label>

          </div>

Condition Expression:

trial-1:

 <bpmn:sequenceFlow id="SequenceFlow_0280oci" name="Approved" sourceRef="ExclusiveGateway_1cl0snn" targetRef="Task_1tmuq1j">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${approved == 'APPROVED'}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>

trial-2:

   <bpmn:sequenceFlow id="SequenceFlow_0280oci" name="Approved" sourceRef="ExclusiveGateway_1cl0snn" targetRef="Task_1tmuq1j">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[approved == 'APPROVED']]></bpmn:conditionExpression>
    </bpmn:sequenceFlow>

trial-3:

</bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="SequenceFlow_063dxi1" name="Rejected" sourceRef="ExclusiveGateway_1cl0snn" targetRef="Task_0o3qykc">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${rejected == 'REJECTED'}]]></bpmn:conditionExpression>
    </bpmn:sequenceFlow>	

ExclusiveGateWay_error.log (52.0 KB)

Hi @revsmadap,

could you please also attach your process definition?

Cheers,
Askar

1 Like

Hi @aakhmerov,

I’m able to solve this by

 <bpmn:sequenceFlow id="SequenceFlow_0280oci" name="Approved" sourceRef="ExclusiveGateway_1cl0snn" targetRef="Task_1tmuq1j">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${ approved == "APPROVED" || approved == 'APPROVED'}]]></bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="SequenceFlow_063dxi1" name="Rejected" sourceRef="ExclusiveGateway_1cl0snn" targetRef="Task_0o3qykc">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${rejected == "REJECTED" || rejected == 'REJECTED'}]]></bpmn:conditionExpression>
    </bpmn:sequenceFlow>
1 Like

Hi,

is there a good way to unit test only the condition expression string?

I don’t mean to check if the bpmn flows correctly, but to just evaluate the expression with one of the process engine services methods ( like assertTrue( evaluateCondition( "${ approved == "APPROVED" || approved == 'APPROVED'}") ).