cancel
Showing results for 
Search instead for 
Did you mean: 

User Task not performed if use Candidate users, ok with Assignee

sheing3003
Champ in-the-making
Champ in-the-making
I'm a beginner to activiti, and I've tried to search to find this answer, but couldn't.

I've tried to do a simple approval request (see following), when rejected it should go back to user to rework on the form and submit it. However, when I put ${eqRequestor} (my initiator) in user task rework request in "candidate users" then the flow won't stop and wait for user input, but if I change ${eqRequestor} to assignee, then it works fine.

Why is that? Shouldn't the candidate users be used this way? From the documentation it looks like a correct usage. Thanks alot!


<?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: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">
  <collaboration id="Collaboration">
    <participant id="pool" name="Pool" processRef="process_pool1"></participant>
  </collaboration>
  <process id="process_pool1" name="TestingProcess_Pool1" isExecutable="true">
    <laneSet id="laneSet_process_pool1">
      <lane id="approver" name="Approver">
        <flowNodeRef>Approve</flowNodeRef>
        <flowNodeRef>exclusivegateway1</flowNodeRef>
        <flowNodeRef>endevent1</flowNodeRef>
      </lane>
      <lane id="requester" name="Requester">
        <flowNodeRef>startevent1</flowNodeRef>
        <flowNodeRef>Rework</flowNodeRef>
      </lane>
    </laneSet>
    <startEvent id="startevent1" name="Start" activiti:initiator="eqRequestor">
      <extensionElements>
        <activiti:formProperty id="equipId" name="EquipmentID" required="true"></activiti:formProperty>
        <activiti:formProperty id="equipName" name="EquipmentN" type="string"></activiti:formProperty>
        <activiti:formProperty id="start" name="startDate" type="date" variable="startDate" datePattern="MM-dd-yyyy"></activiti:formProperty>
        <activiti:formProperty id="direction" name="Direction" type="enum">
          <activiti:value id="left" name="go left"></activiti:value>
          <activiti:value id="right" name="go right"></activiti:value>
          <activiti:value id="up" name="go up"></activiti:value>
        </activiti:formProperty>
      </extensionElements>
    </startEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="Approve"></sequenceFlow>
    <userTask id="Approve" name="Approve Request" activiti:assignee="kermit" activiti:candidateGroups="roleAnyone">
      <documentation>Would you let ${eqRequestor} to buy ${equipName} with the id of ${equipId}</documentation>
      <extensionElements>
        <activiti:formProperty id="equipId" name="equipID" variable="equipmentId" writable="false"></activiti:formProperty>
        <activiti:formProperty id="equipName" name="equipname" variable="equipmentName" writable="false"></activiti:formProperty>
        <activiti:formProperty id="date" name="date" variable="startDate" writable="false"></activiti:formProperty>
        <activiti:formProperty id="arcomment" name="ApproveRequestComment" type="string" required="true"></activiti:formProperty>
        <activiti:formProperty id="eqApprove" name="equipApproval" type="enum" required="true">
          <activiti:value id="true" name="Approve"></activiti:value>
          <activiti:value id="false" name="Reject"></activiti:value>
        </activiti:formProperty>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="Approve" targetRef="exclusivegateway1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="approved" name="approved" sourceRef="exclusivegateway1" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${eqApprove == 'true'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="notApproved" name="not approved" sourceRef="exclusivegateway1" targetRef="Rework">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${eqApprove == 'false'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="Rework" name="Rework Request" activiti:assignee="${eqRequestor}" activiti:candidateUsers="${eqRequestor}">
      <documentation>Your request has been rejected because of:
${arcomment}</documentation>
      <extensionElements>
        <activiti:formProperty id="equipId" name="EquipmentID" variable="equipId" required="true"></activiti:formProperty>
        <activiti:formProperty id="equipName" name="EquipmentN" type="string" variable="equipmentName"></activiti:formProperty>
        <activiti:formProperty id="start" name="startDate" type="date" variable="startDate" datePattern="MM-dd-yyyy"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow5" sourceRef="Rework" targetRef="Approve"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Collaboration">
    <bpmndi:BPMNPlane bpmnElement="Collaboration" id="BPMNPlane_Collaboration">
      <bpmndi:BPMNShape bpmnElement="pool" id="BPMNShape_pool">
        <omgdc:Bounds height="300.0" width="500.0" x="130.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="approver" id="BPMNShape_approver">
        <omgdc:Bounds height="150.0" width="480.0" x="150.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="requester" id="BPMNShape_requester">
        <omgdc:Bounds height="150.0" width="480.0" x="150.0" y="290.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="180.0" y="350.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Approve" id="BPMNShape_Approve">
        <omgdc:Bounds height="55.0" width="105.0" x="240.0" y="190.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="400.0" y="197.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="485.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="Rework" id="BPMNShape_Rework">
        <omgdc:Bounds height="55.0" width="105.0" x="370.0" y="340.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="197.0" y="350.0"></omgdi:waypoint>
        <omgdi:waypoint x="197.0" y="216.0"></omgdi:waypoint>
        <omgdi:waypoint x="240.0" y="217.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="345.0" y="217.0"></omgdi:waypoint>
        <omgdi:waypoint x="400.0" y="217.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="approved" id="BPMNEdge_approved">
        <omgdi:waypoint x="440.0" y="217.0"></omgdi:waypoint>
        <omgdi:waypoint x="485.0" y="217.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="14.0" width="46.0" x="-22.0" y="4.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="notApproved" id="BPMNEdge_notApproved">
        <omgdi:waypoint x="420.0" y="237.0"></omgdi:waypoint>
        <omgdi:waypoint x="422.0" y="340.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="14.0" width="64.0" x="10.0" y="0.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="370.0" y="367.0"></omgdi:waypoint>
        <omgdi:waypoint x="292.0" y="367.0"></omgdi:waypoint>
        <omgdi:waypoint x="292.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi,

Using assignee together with candidate users and groups doesn't make much sense.
You should either use assignee or candidate users and groups.
But yes it should be just fine to use an expression in candidate users as well.

Best regards,