Open Documentation Menu

Using escalations

When modeling your own processes, you can use escalations to influence the process flow. When you start using escalations, it is useful to create a simple process with one user activity and one timer event first. This process will e.g. look like this:

image2019-9-12_10-46-51.png

The BPMN model of this sample process is structured as follows:

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" targetNamespace="" exporter="d.velop process modeler">
  <process id="escalation_process" name="Escalation Process" isExecutable="true">
    <startEvent id="start" />
    <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('dv_initiator')}" />  
    <boundaryEvent id="timer" attachedToRef="task_hello_world">
      <timerEventDefinition>
        <timeDuration>PT1M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="end" />
    <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" />
    <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" />
    <sequenceFlow id="s3" sourceRef="timer" targetRef="end" />
  </process>
</definitions>

We now want to modify this sample process so an escalation is triggered when a timer event occurs. The escalation will then start a subprocess that describes the escalation path. First, you need to create an escalation object for this modification.

Adding an escalation object 

First add the BPMN item escalation.

...
<definitions ...>
  <process id="escalation_process" name="Escalation Process" isExecutable="true">
    ...
  </process>
  <escalation id="time_escalation" name="Time Escalation" escalationCode="123" />
</definitions>

Explanation of the properties: 

  • id: The property is used as a unique identifier for the escalation.

  • name: The display name of the escalation.

  • escalationCode: The property defines a technical code that can be used on items waiting for escalations in order to identify the triggering escalation.

Now the escalation can be used in the BPMN item IntermediateThrowEvent or an EndEvent in order to trigger a corresponding escalation event.

Adding an escalation event 

First add the BPMN item IntermediateThrowEvent with an EscalationEventDefinition element to the process. Then change the target of the sequence flow s3 running from end to throw_time_escalation, and then add a new sequence flow s4 running from throw_time_escalation to end.

...
<process id="escalation_process" name="Escalation Process" isExecutable="true">
  ...
  <intermediateThrowEvent id="throw_time_escalation">
    <escalationEventDefinition escalationRef="time_escalation" />
  </intermediateThrowEvent>
  <endEvent id="end" />
  ...
  <sequenceFlow id="s3" sourceRef="timer" targetRef="throw_time_escalation" />
  <sequenceFlow id="s4" sourceRef="throw_time_escalation" targetRef="end" />
</process>
<escalation id="time_escalation" name="Time Escalation" escalationCode="123" />
...

This is what the process now looks like:

image2019-9-12_11-5-3.png

Adding an escalation path 

Now add a subprocess whose BPMN item StartEvent contains the item EscalationEventDefinition.

...
<process id="escalation_process" name="Escalation Process" isExecutable="true">
  <extensionElements>
    <camunda:properties>
      <camunda:property name="variable:escalationCode" value="String" />
    </camunda:properties>
  </extensionElements>
  <startEvent id="start" />
  ...
  <sequenceFlow id="s4" sourceRef="throw_time_escalation" targetRef="end" />
  <subProcess id="escalation_subprocess" name="Escalation Process" triggeredByEvent="true">
    <startEvent id="sub_start" isInterrupting="false">
      <escalationEventDefinition escalationRef="time_escalation" camunda:escalationCodeVariable="escalationCode" />
    </startEvent>
    <endEvent id="sub_end" />
    <sequenceFlow id="sub_s1" sourceRef="sub_start" targetRef="sub_end" />
  </subProcess>
</process> 
<escalation id="time_escalation" name="Time Escalation" escalationCode="123" />
...

Explanation of the properties: 

  • subProcess 

    • triggeredByEvent: must contain the value true. The property specifies that the start event of this subprocess is triggered by an event (an escalation event in this case).

    • isInterrupting: If it is true, the process branch that triggered the escalation is terminated. If it is false, the process branch continues to run in parallel.

  • escalationEventDefinition 

    • escalationRef: Contains the ID of the escalation that is to be used to trigger this event.

    • camunda:escalationCodeVariable: (optional) name of the variables in which the value of escalationCode of the occurring escalation is to be saved (variable must be defined).

Note that when you use the property camunda:escalationCodeVariable, you also need to add a definition of the corresponding process variables in the main process.

Now add an additional user activity that should be run in the event of an escalation.

...
<process id="escalation_process" name="Escalation Process" isExecutable="true">
  ...
  <subProcess id="escalation_subprocess" name="Escalation Process" triggeredByEvent="true">
    <startEvent id="sub_start" isInterrupting="false">
      <escalationEventDefinition escalationRef="time_escalation" camunda:escalationCodeVariable="escalationCode" />
    </startEvent>       
        <userTask id="sub_task_escalation" name="Escalation occurred" camunda:candidateUsers="${variables.get('dv_initiator')}" />
    <endEvent id="sub_end" />
    <sequenceFlow id="sub_s1" sourceRef="sub_start" targetRef="sub_task_escalation" />
    <sequenceFlow id="sub_s2" sourceRef="sub_task_escalation" targetRef="sub_end" />
  </subProcess>
</process> 
<escalation id="time_escalation" name="Time Escalation" escalationCode="123" />
...

For reasons of simplification, the user that started the process is entered as the recipient of the user activity of the escalation path.

This is what the final process looks like:

image2019-9-12_12-13-44.png

In order for the BPMN diagram to be displayed correctly in the modeling tool as well as the user interface, diagram information has been added. The final BPMN definition looks as follows:

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI"  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="" exporter="d.velop process modeler">
  <process id="escalation_process" name="Escalation Process" isExecutable="true">
    <extensionElements>
      <camunda:properties>
        <camunda:property name="variable:escalationCode" value="String" />
      </camunda:properties>
    </extensionElements>

    <startEvent id="start" />
    <userTask id="task_hello_world" name="Hello World" camunda:candidateUsers="${variables.get('dv_initiator')}" />    
    <boundaryEvent id="timer" attachedToRef="task_hello_world">
      <timerEventDefinition>
        <timeDuration>PT1M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <intermediateThrowEvent id="throw_time_escalation">
      <escalationEventDefinition escalationRef="time_escalation" />
    </intermediateThrowEvent>
    <endEvent id="end" />

    <sequenceFlow id="s1" sourceRef="start" targetRef="task_hello_world" />
    <sequenceFlow id="s2" sourceRef="task_hello_world" targetRef="end" />
    <sequenceFlow id="s3" sourceRef="timer" targetRef="throw_time_escalation" />
    <sequenceFlow id="s4" sourceRef="throw_time_escalation" targetRef="end" />

    <subProcess id="escalation_subprocess" name="Escalation Process" triggeredByEvent="true">
      <startEvent id="sub_start" isInterrupting="false">
        <escalationEventDefinition escalationRef="time_escalation" camunda:escalationCodeVariable="escalationCode" />
      </startEvent>
      <userTask id="sub_task_escalation" name="Escalation occurred" camunda:candidateUsers="${variables.get('dv_initiator')}" />
      <endEvent id="sub_end" />
      <sequenceFlow id="sub_s1" sourceRef="sub_start" targetRef="sub_task_escalation" />
      <sequenceFlow id="sub_s2" sourceRef="sub_task_escalation" targetRef="sub_end" />
    </subProcess>

  </process>
  <escalation id="time_escalation" name="Time Escalation" escalationCode="123" />

  <!-- Diagram information -->
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="escalation_process">
      <bpmndi:BPMNShape id="start_di" bpmnElement="start">
        <dc:Bounds x="179" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="task_hello_world_di" bpmnElement="task_hello_world">
        <dc:Bounds x="290" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="timer_di" bpmnElement="timer">
        <dc:Bounds x="372" y="139" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="throw_time_escalation_di" bpmnElement="throw_time_escalation">
        <dc:Bounds x="432" y="202" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="end_di" bpmnElement="end">
        <dc:Bounds x="492" y="99" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="s1_di" bpmnElement="s1">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="290" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="s2_di" bpmnElement="s2">
        <di:waypoint x="390" y="117" />
        <di:waypoint x="492" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="s3_di" bpmnElement="s3">
        <di:waypoint x="390" y="175" />
        <di:waypoint x="390" y="220" />
        <di:waypoint x="432" y="220" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="s4_di" bpmnElement="s4">
        <di:waypoint x="468" y="220" />
        <di:waypoint x="510" y="220" />
        <di:waypoint x="510" y="135" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="escalation_subprocess_di" bpmnElement="escalation_subprocess" isExpanded="true">
        <dc:Bounds x="165" y="290" width="350" height="200" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="sub_start_di" bpmnElement="sub_start">
        <dc:Bounds x="205" y="372" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="sub_task_escalation_di" bpmnElement="sub_task_escalation">
        <dc:Bounds x="290" y="350" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="sub_end_di" bpmnElement="sub_end">
        <dc:Bounds x="442" y="372" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="sub_s1_di" bpmnElement="sub_s1">
        <di:waypoint x="241" y="390" />
        <di:waypoint x="290" y="390" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="sub_s2_di" bpmnElement="sub_s2">
        <di:waypoint x="390" y="390" />
        <di:waypoint x="442" y="390" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>