How to send task back to initiator


process started by titan_store_manager@gardler.com

in diagram it showing process is at Initiator user task but when I login as initiator(titan_store_manager@gardler.com ) I am not getting the task forward by Dispatcher, the task query is as follows
tasks = taskService.createTaskQuery().taskAssignee(user.getEmail()).list();

returns 0

my bpmn is as follows

<?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:flowable="http://flowable.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.flowable.org/processdef">
  <process id="crm-warranty" name="crm warranty" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <userTask id="sid-D092143E-550B-4C7B-91DD-EA419AD3FCB1" name="Create Ticket" flowable:assignee="$INITIATOR" flowable:formKey="ticket-form">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-42668AA2-8B74-4A02-9FB8-380126213436" sourceRef="startEvent1" targetRef="sid-D092143E-550B-4C7B-91DD-EA419AD3FCB1"></sequenceFlow>
    <userTask id="sid-907BCF3C-FFB9-48AD-893F-FD5AA188FD5A" name="Sales Person" flowable:assignee="${salesPerson}" flowable:formKey="sales-form">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <userTask id="sid-14B7DD1C-5288-4136-9168-9A18C8E235F2" name="Coordinator" flowable:assignee="${coordinator}" flowable:formKey="coordinator-form">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7"></exclusiveGateway>
    <sequenceFlow id="sid-02EDD7A3-3ED0-498B-BB9D-961FC4358168" sourceRef="sid-14B7DD1C-5288-4136-9168-9A18C8E235F2" targetRef="sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7"></sequenceFlow>
    <sequenceFlow id="sid-705494E6-15C5-47E5-9B49-5151256EB4B4" sourceRef="sid-D092143E-550B-4C7B-91DD-EA419AD3FCB1" targetRef="sid-907BCF3C-FFB9-48AD-893F-FD5AA188FD5A"></sequenceFlow>
    <exclusiveGateway id="sid-F4E48AE1-5F75-4367-988D-D55A22C26645"></exclusiveGateway>
    <sequenceFlow id="sid-DFAD7789-6E13-4364-B4E5-71F96A4E9E78" sourceRef="sid-907BCF3C-FFB9-48AD-893F-FD5AA188FD5A" targetRef="sid-F4E48AE1-5F75-4367-988D-D55A22C26645"></sequenceFlow>
    <sequenceFlow id="sid-6100E6B2-DF02-4591-8C8B-48D05E8B87C3" name="Approve" sourceRef="sid-F4E48AE1-5F75-4367-988D-D55A22C26645" targetRef="sid-14B7DD1C-5288-4136-9168-9A18C8E235F2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve}]]></conditionExpression>
    </sequenceFlow>
    <intermediateThrowEvent id="sid-5883A8CB-2A34-411C-B7D7-013CFA47C4CC"></intermediateThrowEvent>
    <sequenceFlow id="sid-1A408567-6974-455F-8B5E-4840A9B74752" name="Reject" sourceRef="sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7" targetRef="sid-5883A8CB-2A34-411C-B7D7-013CFA47C4CC">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approve}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-B51C96C3-9159-48F4-B311-4E2047CBA853" name="Reject" sourceRef="sid-F4E48AE1-5F75-4367-988D-D55A22C26645" targetRef="sid-26BCBF3B-F5BE-455C-9EBB-648174DA656A">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${!approve}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="sid-26BCBF3B-F5BE-455C-9EBB-648174DA656A"></endEvent>
    <userTask id="sid-6C88A91F-51E5-480D-A886-F13A64D8353C" name="Issuer" flowable:candidateUsers="santosh@gardlerlighting.com">
      <extensionElements>
         <modeler:activiti-idm-candidate-user xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-user>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-1B07662F-F8D4-4884-A583-DE5E83C521B0" name="Approved" sourceRef="sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7" targetRef="sid-6C88A91F-51E5-480D-A886-F13A64D8353C">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="sid-1EB85B28-7C64-459E-8CC9-C4C473082EBD" name="Dispatcher" flowable:candidateUsers="balaji@gardlerlighting.com">
      <extensionElements>
         <modeler:activiti-idm-candidate-user xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-user>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-71AE054D-FD24-4E8C-B9D1-C13F28357164" sourceRef="sid-6C88A91F-51E5-480D-A886-F13A64D8353C" targetRef="sid-1EB85B28-7C64-459E-8CC9-C4C473082EBD"></sequenceFlow>
    <userTask id="sid-66677DD2-70A7-4C8F-930A-2A5A7A508632" name="Initiator" flowable:assignee="$INITIATOR">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <userTask id="sid-808FD524-24BE-4313-803E-8C476354B0F8" name="Dispatcher" flowable:candidateUsers="balaji@gardlerlighting.com">
      <extensionElements>
         <modeler:activiti-idm-candidate-user xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-user>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-FA97D413-910D-4501-A64D-4494D61BCA06" sourceRef="sid-66677DD2-70A7-4C8F-930A-2A5A7A508632" targetRef="sid-808FD524-24BE-4313-803E-8C476354B0F8"></sequenceFlow>
    <endEvent id="sid-91535738-1829-4E04-ABF0-5AE5345BC62C"></endEvent>
    <sequenceFlow id="sid-98E737EF-F960-4F4B-B811-7FF74280346D" sourceRef="sid-808FD524-24BE-4313-803E-8C476354B0F8" targetRef="sid-91535738-1829-4E04-ABF0-5AE5345BC62C"></sequenceFlow>
    <sequenceFlow id="sid-8173B486-B640-4153-AC14-AF863DA26C4D" sourceRef="sid-1EB85B28-7C64-459E-8CC9-C4C473082EBD" targetRef="sid-66677DD2-70A7-4C8F-930A-2A5A7A508632"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_crm-warranty">
    <bpmndi:BPMNPlane bpmnElement="crm-warranty" id="BPMNPlane_crm-warranty">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="229.0" y="162.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-D092143E-550B-4C7B-91DD-EA419AD3FCB1" id="BPMNShape_sid-D092143E-550B-4C7B-91DD-EA419AD3FCB1">
        <omgdc:Bounds height="80.0" width="100.0" x="330.0" y="136.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-907BCF3C-FFB9-48AD-893F-FD5AA188FD5A" id="BPMNShape_sid-907BCF3C-FFB9-48AD-893F-FD5AA188FD5A">
        <omgdc:Bounds height="80.0" width="100.0" x="480.0" y="131.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-14B7DD1C-5288-4136-9168-9A18C8E235F2" id="BPMNShape_sid-14B7DD1C-5288-4136-9168-9A18C8E235F2">
        <omgdc:Bounds height="80.0" width="100.0" x="769.0" y="124.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7" id="BPMNShape_sid-1B8235DA-2E13-4CBC-9DC4-D3033C0EB1D7">
        <omgdc:Bounds height="40.0" width="40.0" x="930.0" y="143.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-F4E48AE1-5F75-4367-988D-D55A22C26645" id="BPMNShape_sid-F4E48AE1-5F75-4367-988D-D55A22C26645">
        <omgdc:Bounds height="40.0" width="40.0" x="625.0" y="151.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-5883A8CB-2A34-411C-B7D7-013CFA47C4CC" id="BPMNShape_sid-5883A8CB-2A34-411C-B7D7-013CFA47C4CC">
        <omgdc:Bounds height="30.0" width="30.0" x="935.0" y="225.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-26BCBF3B-F5BE-455C-9EBB-648174DA656A" id="BPMNShape_sid-26BCBF3B-F5BE-455C-9EBB-648174DA656A">
        <omgdc:Bounds height="28.0" width="28.0" x="631.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-6C88A91F-51E5-480D-A886-F13A64D8353C" id="BPMNShape_sid-6C88A91F-51E5-480D-A886-F13A64D8353C">
        <omgdc:Bounds height="80.0" width="100.0" x="1019.0" y="121.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-1EB85B28-7C64-459E-8CC9-C4C473082EBD" id="BPMNShape_sid-1EB85B28-7C64-459E-8CC9-C4C473082EBD">
        <omgdc:Bounds height="80.0" width="100.0" x="1035.0" y="330.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-66677DD2-70A7-4C8F-930A-2A5A7A508632" id="BPMNShape_sid-66677DD2-70A7-4C8F-930A-2A5A7A508632">
        <omgdc:Bounds height="80.0" width="100.0" x="810.0" y="330.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-808FD524-24BE-4313-803E-8C476354B0F8" id="BPMNShape_sid-808FD524-24BE-4313-803E-8C476354B0F8">
        <omgdc:Bounds height="80.0" width="100.0" x="615.0" y="330.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-91535738-1829-4E04-ABF0-5AE5345BC62C" id="BPMNShape_sid-91535738-1829-4E04-ABF0-5AE5345BC62C">
        <omgdc:Bounds height="28.0" width="28.0" x="451.0" y="356.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-8173B486-B640-4153-AC14-AF863DA26C4D" id="BPMNEdge_sid-8173B486-B640-4153-AC14-AF863DA26C4D">
        <omgdi:waypoint x="1034.999999999999" y="370.23232558139534"></omgdi:waypoint>
        <omgdi:waypoint x="909.9499999999999" y="370.8139534883721"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1A408567-6974-455F-8B5E-4840A9B74752" id="BPMNEdge_sid-1A408567-6974-455F-8B5E-4840A9B74752">
        <omgdi:waypoint x="950.0" y="182.93706225680936"></omgdi:waypoint>
        <omgdi:waypoint x="950.0" y="225.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1B07662F-F8D4-4884-A583-DE5E83C521B0" id="BPMNEdge_sid-1B07662F-F8D4-4884-A583-DE5E83C521B0">
        <omgdi:waypoint x="969.6202479338826" y="162.66942148760336"></omgdi:waypoint>
        <omgdi:waypoint x="1018.9999999999976" y="161.83949579831935"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-71AE054D-FD24-4E8C-B9D1-C13F28357164" id="BPMNEdge_sid-71AE054D-FD24-4E8C-B9D1-C13F28357164">
        <omgdi:waypoint x="1069.0" y="200.95"></omgdi:waypoint>
        <omgdi:waypoint x="1069.0" y="330.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-705494E6-15C5-47E5-9B49-5151256EB4B4" id="BPMNEdge_sid-705494E6-15C5-47E5-9B49-5151256EB4B4">
        <omgdi:waypoint x="429.9499999999989" y="174.33333333333334"></omgdi:waypoint>
        <omgdi:waypoint x="479.99999999999983" y="172.66500000000002"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-DFAD7789-6E13-4364-B4E5-71F96A4E9E78" id="BPMNEdge_sid-DFAD7789-6E13-4364-B4E5-71F96A4E9E78">
        <omgdi:waypoint x="579.95" y="171.0"></omgdi:waypoint>
        <omgdi:waypoint x="625.0" y="171.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-6100E6B2-DF02-4591-8C8B-48D05E8B87C3" id="BPMNEdge_sid-6100E6B2-DF02-4591-8C8B-48D05E8B87C3">
        <omgdi:waypoint x="664.178453038674" y="170.22651933701658"></omgdi:waypoint>
        <omgdi:waypoint x="768.9999999999997" y="166.0094827586207"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-42668AA2-8B74-4A02-9FB8-380126213436" id="BPMNEdge_sid-42668AA2-8B74-4A02-9FB8-380126213436">
        <omgdi:waypoint x="258.9496043013596" y="176.8897088016321"></omgdi:waypoint>
        <omgdi:waypoint x="329.9999999999941" y="176.36727941176468"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-98E737EF-F960-4F4B-B811-7FF74280346D" id="BPMNEdge_sid-98E737EF-F960-4F4B-B811-7FF74280346D">
        <omgdi:waypoint x="614.9999999999934" y="370.0"></omgdi:waypoint>
        <omgdi:waypoint x="478.9499233524595" y="370.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-FA97D413-910D-4501-A64D-4494D61BCA06" id="BPMNEdge_sid-FA97D413-910D-4501-A64D-4494D61BCA06">
        <omgdi:waypoint x="810.0" y="370.0"></omgdi:waypoint>
        <omgdi:waypoint x="714.9499999999999" y="370.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-02EDD7A3-3ED0-498B-BB9D-961FC4358168" id="BPMNEdge_sid-02EDD7A3-3ED0-498B-BB9D-961FC4358168">
        <omgdi:waypoint x="868.9499999999975" y="163.61832061068702"></omgdi:waypoint>
        <omgdi:waypoint x="930.1515151515146" y="163.15113636363637"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-B51C96C3-9159-48F4-B311-4E2047CBA853" id="BPMNEdge_sid-B51C96C3-9159-48F4-B311-4E2047CBA853">
        <omgdi:waypoint x="645.0" y="190.93799638989174"></omgdi:waypoint>
        <omgdi:waypoint x="645.0" y="240.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

@infinitysiddhu, are you certain that the username is an email address? On at least one occasion, I ran into flowable-idm not allowing me to log in with an email address for a username. If you’ve got flowable-admin running, you can look for the task in the Process Engine -> Task list and see who the assignee is.

Will

I checked and it showing assignee as $INITIATOR, but when login as titan user I am not able to get the task. none of thease task querys giveing result.

tasks = taskService.createTaskQuery().taskOwner(user.getEmail()).orderByTaskCreateTime().desc().list();
System.out.println(“11. You have " + tasks.size() + " tasks:”);
tasks =taskService.createTaskQuery().taskCandidateOrAssigned(user.getEmail()).list();
System.out.println(“12. You have " + tasks.size() + " tasks:”);
tasks =taskService.createTaskQuery().taskAssignee(user.getEmail()).list();
System.out.println(“13. You have " + tasks.size() + " tasks:”);
taskService.createTaskQuery().taskCandidateUser(user.getEmail()).list();
System.out.println(“15. You have " + tasks.size() + " tasks:”);
tasks =taskService.createTaskQuery().taskInvolvedUser(user.getEmail()).list();
System.out.println(“14. You have " + tasks.size() + " tasks:”);

Is it showing as the string “$INITIATOR”? How are you starting the process?

// Convert POJO to Map
Map<String, Object> map = new HashMap<String, Object>() ;
map.put(“product”, ticket.getProduct());
map.put(“phoneNumber”, ticket.getPhoneNumber());
map.put(“defectiveQuantity”, ticket.getDefectiveQuantity());
map.put(“description”, ticket.getDescription());
map.put(“requestorName”, ticket.getRequestorName());
map.put(“state”, ticket.getState());
map.put(“city”, ticket.getCity());
map.put(“storeLocation”, ticket.getStoreLocation());
map.put(“salesComments”, ticket.getSalesComments());
map.put(“projectComments”, ticket.getProjectComments());
map.put(“warehouseComments”, ticket.getWarehouseComments());
map.put(“initiator”,user.getEmail());
map.put(“salesPerson”, salesPersonService.getSalesPerson(ticket.getState()));

	ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("crm-warranty", map);
	Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
	task.setOwner(user.getEmail());
	taskService.saveTask(task);
	taskService.complete(task.getId(), map);
	System.out.println(task.getCreateTime());

I think the issue is that you’re trying to pull the initiator out of a process variable using the the built in “$INITIATOR”.

If you’re going to pass it in as part of the process variables, try referencing it as ${initiator}, though I would suggest changing the variable name so you don’t conflict with the engine attempting to set the initiator base on the logged in user.