<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:collaboration id="Collaboration_1vzc4e2">
    <bpmn2:participant id="Participant_1g6enp2" processRef="Process_1" />
  </bpmn2:collaboration>
  <bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:startEvent id="StartEvent_0wntki2">
      <bpmn2:extensionElements>
        <camunda:executionListener event="start">
          <camunda:script scriptFormat="JavaScript">data.clients=["a","b","c"];</camunda:script>
        </camunda:executionListener>
      </bpmn2:extensionElements>
      <bpmn2:outgoing>SequenceFlow_129vlnl</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:subProcess id="task_subProcess">
      <bpmn2:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="clients">[1,2,3]</camunda:inputParameter>
        </camunda:inputOutput>
      </bpmn2:extensionElements>
      <bpmn2:incoming>SequenceFlow_0664zm3</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1dt9jvl</bpmn2:outgoing>
      <bpmn2:startEvent id="sub_StartEvent">
        <bpmn2:extensionElements>
          <camunda:executionListener event="start">
            <camunda:script scriptFormat="JavaScript">data.clients=[1,2,3];
console.log('sub data',data);</camunda:script>
          </camunda:executionListener>
        </bpmn2:extensionElements>
        <bpmn2:outgoing>SequenceFlow_1e6hdeg</bpmn2:outgoing>
      </bpmn2:startEvent>
      <bpmn2:endEvent id="sub_endEvent">
        <bpmn2:incoming>SequenceFlow_0x4vp34</bpmn2:incoming>
      </bpmn2:endEvent>
      <bpmn2:sequenceFlow id="SequenceFlow_1811kcu" sourceRef="sub_task_1" targetRef="sub_usertask_2" />
      <bpmn2:scriptTask id="sub_task_1" name="Send Emails to Clients">
        <bpmn2:incoming>SequenceFlow_1e6hdeg</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_1811kcu</bpmn2:outgoing>
        <bpmn2:multiInstanceLoopCharacteristics camunda:collection="$(this.data.clients)" />
      </bpmn2:scriptTask>
      <bpmn2:sequenceFlow id="SequenceFlow_0x4vp34" sourceRef="sub_usertask_2" targetRef="sub_endEvent" />
      <bpmn2:userTask id="sub_usertask_2" name="Follow-up with Clients">
        <bpmn2:incoming>SequenceFlow_1811kcu</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_0x4vp34</bpmn2:outgoing>
      </bpmn2:userTask>
      <bpmn2:sequenceFlow id="SequenceFlow_1e6hdeg" sourceRef="sub_StartEvent" targetRef="sub_task_1" />
    </bpmn2:subProcess>
    <bpmn2:userTask id="Task_design" name="Design Campaign">
      <bpmn2:extensionElements>
        <camunda:executionListener event="start">
          <camunda:script scriptFormat="JavaScript">console.log('data',this.data);</camunda:script>
        </camunda:executionListener>
      </bpmn2:extensionElements>
      <bpmn2:incoming>SequenceFlow_129vlnl</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_0664zm3</bpmn2:outgoing>
    </bpmn2:userTask>
    <bpmn2:sequenceFlow id="SequenceFlow_129vlnl" sourceRef="StartEvent_0wntki2" targetRef="Task_design" />
    <bpmn2:sequenceFlow id="SequenceFlow_0664zm3" sourceRef="Task_design" targetRef="task_subProcess" />
    <bpmn2:sequenceFlow id="Flow_1dt9jvl" sourceRef="task_subProcess" targetRef="Activity_0hrqkhp" />
    <bpmn2:sequenceFlow id="Flow_1qkp3z8" sourceRef="Activity_0hrqkhp" targetRef="EndEvent_08zhy2j" />
    <bpmn2:endEvent id="EndEvent_08zhy2j">
      <bpmn2:extensionElements>
        <camunda:executionListener event="start">
          <camunda:script scriptFormat="JavaScript">console.log('end main proc',data);</camunda:script>
        </camunda:executionListener>
      </bpmn2:extensionElements>
      <bpmn2:incoming>Flow_1qkp3z8</bpmn2:incoming>
      <bpmn2:incoming>Flow_1phzjsc</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="Flow_1x5xedf" name="Stop" sourceRef="Event_1m4letg" targetRef="Activity_1nwviii" />
    <bpmn2:boundaryEvent id="Event_1m4letg" attachedToRef="task_subProcess">
      <bpmn2:outgoing>Flow_1x5xedf</bpmn2:outgoing>
      <bpmn2:messageEventDefinition id="MessageEventDefinition_0lhso7t" messageRef="Message_1ljoet1" />
    </bpmn2:boundaryEvent>
    <bpmn2:sequenceFlow id="Flow_1phzjsc" sourceRef="Activity_1nwviii" targetRef="EndEvent_08zhy2j" />
    <bpmn2:scriptTask id="Activity_0hrqkhp" name="Finalize">
      <bpmn2:incoming>Flow_1dt9jvl</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1qkp3z8</bpmn2:outgoing>
    </bpmn2:scriptTask>
    <bpmn2:scriptTask id="Activity_1nwviii" name="Wrap-up">
      <bpmn2:incoming>Flow_1x5xedf</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1phzjsc</bpmn2:outgoing>
    </bpmn2:scriptTask>
  </bpmn2:process>
  <bpmn2:message id="Message_1ljoet1" name="Cancel_Campaign" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1vzc4e2">
      <bpmndi:BPMNShape id="Participant_1g6enp2_di" bpmnElement="Participant_1g6enp2" isHorizontal="true">
        <dc:Bounds x="140" y="14" width="900" height="336" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1x5xedf_di" bpmnElement="Flow_1x5xedf">
        <di:waypoint x="730" y="282" />
        <di:waypoint x="730" y="290" />
        <di:waypoint x="840" y="290" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="788" y="273" width="23" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1qkp3z8_di" bpmnElement="Flow_1qkp3z8">
        <di:waypoint x="910" y="190" />
        <di:waypoint x="952" y="190" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1dt9jvl_di" bpmnElement="Flow_1dt9jvl">
        <di:waypoint x="785" y="190" />
        <di:waypoint x="810" y="190" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0664zm3_di" bpmnElement="SequenceFlow_0664zm3">
        <di:waypoint x="344" y="170" />
        <di:waypoint x="367" y="170" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="311" y="149" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_129vlnl_di" bpmnElement="SequenceFlow_129vlnl">
        <di:waypoint x="214" y="170" />
        <di:waypoint x="244" y="170" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="184" y="149" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1phzjsc_di" bpmnElement="Flow_1phzjsc">
        <di:waypoint x="940" y="290" />
        <di:waypoint x="970" y="290" />
        <di:waypoint x="970" y="208" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="StartEvent_0wntki2_di" bpmnElement="StartEvent_0wntki2">
        <dc:Bounds x="178" y="152" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="151" y="192" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1bsd6nr_di" bpmnElement="Activity_0hrqkhp">
        <dc:Bounds x="810" y="150" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1us56p3_di" bpmnElement="Activity_1nwviii">
        <dc:Bounds x="840" y="250" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="SubProcess_1n2k7z1_di" bpmnElement="task_subProcess" isExpanded="true">
        <dc:Bounds x="367" y="75" width="418" height="189" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1e6hdeg_di" bpmnElement="SequenceFlow_1e6hdeg">
        <di:waypoint x="428" y="180" />
        <di:waypoint x="462" y="180" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="400" y="159" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0x4vp34_di" bpmnElement="SequenceFlow_0x4vp34">
        <di:waypoint x="694" y="180" />
        <di:waypoint x="729" y="180" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="667" y="159" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_1811kcu_di" bpmnElement="SequenceFlow_1811kcu">
        <di:waypoint x="562" y="180" />
        <di:waypoint x="594" y="180" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="533" y="159" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="sub_StartEvent_di" bpmnElement="sub_StartEvent">
        <dc:Bounds x="392" y="162" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="365" y="202" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="sub_endEvent_di" bpmnElement="sub_endEvent">
        <dc:Bounds x="729" y="162" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="702" y="202" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ScriptTask_0jwnlkn_di" bpmnElement="sub_task_1">
        <dc:Bounds x="462" y="140" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="UserTask_1rwwtjj_di" bpmnElement="sub_usertask_2">
        <dc:Bounds x="594" y="140" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="UserTask_121jsnk_di" bpmnElement="Task_design">
        <dc:Bounds x="244" y="130" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="EndEvent_08zhy2j_di" bpmnElement="EndEvent_08zhy2j">
        <dc:Bounds x="952" y="172" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="790" y="192" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1ydqp59_di" bpmnElement="Event_1m4letg">
        <dc:Bounds x="712" y="246" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>
