AnsweredAssumed Answered

Setting and Retrieving Conditional Expression value

Question asked by sandeepsapra on Jun 29, 2011
Latest reply on Jul 4, 2011 by jbarrez
Scenario :  I am trying to build a workflow where in a user/author will enter the comments and approver can approve or reject it.  In case of reject flow should go to the user/author again and if approved it will end. Conditional Expression  (variable 'approvalStatus') is given in bpmn file to decide this flow.

Problem  : 
1.) What is way out to set the value of the variable 'approvalStatus'  in the java code so that when approver reject , the flow should go back author.
I am trying to do this way and not sure if it is correct (17610 is my execution ID , false say for a reject case)
runtimeService.setVariable("17610", "approvalDecision",false);

This is just setting value in ACT_RY_VARIABLE table but the flow remains with the approver only

2.) Is my bpmn file correct for the flow I want ?
Please find below the bpmn file:

……………………………………
  <process id="commentsVerification" name="Comments Workflow Verification Process">
      <startEvent id="theStart" />
  
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="enterCommentsTask" />
    <userTask id="enterCommentsTask" name="Enter Comments by Author" >
     <documentation>
        Enter Comments which requires verification
      </documentation>
      <potentialOwner>
        <resourceAssignmentExpression>
          <formalExpression>author</formalExpression>
        </resourceAssignmentExpression>
      </potentialOwner>
    </userTask>
   
    <sequenceFlow id="flow2" sourceRef="enterCommentsTask"  targetRef="verifyCommentsTask" />
     <userTask id="verifyCommentsTask" name="Verify Comments by Approver" >
          <documentation>
        Verify Comments entered by the author. 
      </documentation>
      <potentialOwner>
        <resourceAssignmentExpression>
          <formalExpression>approver</formalExpression>
        </resourceAssignmentExpression>
      </potentialOwner>
    </userTask>
   
    <sequenceFlow id="flow3" sourceRef="verifyCommentsTask" targetRef="approvalDecision" />
     <exclusiveGateway id="approvalDecision" />
    <sequenceFlow id="flow4" sourceRef="approvalDecision" targetRef="enterCommentsTask">
      <conditionExpression>${!approvalStatus}</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="approvalDecision" targetRef="theEnd">
      <conditionExpression>${approvalStatus}</conditionExpression>
    </sequenceFlow>
    <endEvent id="theEnd" />
  </process>
……………………….


Regards,
Sandeep

Outcomes