17. Escalation & Reminders (Common Use Cases)

These patterns demonstrate how to handle overdue tasks using Non-Interrupting Boundary Events (cancelActivity="false"). This ensures the task remains active while the system performs the escalation action.

Case 1: Reassign if not completed in 2 days

If the task sits for 48 hours, automatically transfer it to a manager.

<userTask id="task" name="Employee Task" flowable:assignee="${employee}"/>

<!-- Non-interrupting timer: triggers after 2 days -->
<boundaryEvent id="timer2days" attachedToRef="task" cancelActivity="false">
    <timerEventDefinition>
        <timeDuration>P2D</timeDuration>
    </timerEventDefinition>
</boundaryEvent>

<sequenceFlow sourceRef="timer2days" targetRef="escalateToManager"/>

<serviceTask id="escalateToManager" flowable:delegateExpression="${reassignTask}">
    <extensionElements>
        <flowable:field name="targetAssignee" stringValue="manager@workingflow.com"/>
        <flowable:field name="clearExisting" stringValue="true"/>
    </extensionElements>
</serviceTask>

Case 2: Reassign if not completed by Specific Date

If the "Due Date" set in a previous form (variable dueDate) passes, reassign the task.

<userTask id="task" name="Time Sensitive Task" flowable:assignee="${employee}"/>

<!-- Non-interrupting timer: triggers at specific ISO date stored in variable -->
<boundaryEvent id="timerDate" attachedToRef="task" cancelActivity="false">
    <timerEventDefinition>
        <timeDate>${dueDate}</timeDate>
    </timerEventDefinition>
</boundaryEvent>

<sequenceFlow sourceRef="timerDate" targetRef="reassignToBackup"/>

<serviceTask id="reassignToBackup" flowable:delegateExpression="${reassignTask}">
    <extensionElements>
        <flowable:field name="targetAssignee" stringValue="backup_user@workingflow.com"/>
        <flowable:field name="clearExisting" stringValue="true"/>
    </extensionElements>
</serviceTask>

Case 3: Email if not completed in 2 days

Send a "Nudge" email if the task is pending for 48 hours, but keep the task assigned to the user.

<userTask id="task" name="Employee Task" flowable:assignee="${employee}"/>

<boundaryEvent id="nudgeTimer" attachedToRef="task" cancelActivity="false">
    <timerEventDefinition>
        <timeDuration>P2D</timeDuration>
    </timerEventDefinition>
</boundaryEvent>

<sequenceFlow sourceRef="nudgeTimer" targetRef="sendNudge"/>

<serviceTask id="sendNudge" flowable:delegateExpression="${sendReminder}">
    <extensionElements>
        <flowable:field name="to" expression="${employee}"/>
        <flowable:field name="subject" stringValue="Task Overdue"/>
        <flowable:field name="body" stringValue="This task has been pending for 2 days."/>
    </extensionElements>
</serviceTask>

Case 4: Email if not completed by Specific Date

Send a warning email if the deadline (dueDate variable) passes.

<userTask id="task" name="Deadline Task" flowable:assignee="${employee}"/>

<boundaryEvent id="deadlineTimer" attachedToRef="task" cancelActivity="false">
    <timerEventDefinition>
        <timeDate>${dueDate}</timeDate>
    </timerEventDefinition>
</boundaryEvent>

<sequenceFlow sourceRef="deadlineTimer" targetRef="sendWarning"/>

<serviceTask id="sendWarning" flowable:delegateExpression="${sendReminder}">
    <extensionElements>
        <flowable:field name="to" expression="${employee}"/>
        <flowable:field name="subject" stringValue="Deadline Missed"/>
        <flowable:field name="body" stringValue="You have missed the deadline for this task."/>
    </extensionElements>
</serviceTask>
```xml
<userTask id="pendingTask" name="Pending Approval" flowable:assignee="${assignee}"/>

<!-- Non-interrupting, repeating timer: sends reminder every hour -->
<boundaryEvent id="reminderTimer" attachedToRef="pendingTask" cancelActivity="false">
    <timerEventDefinition>
        <timeCycle>R/PT1H</timeCycle>
    </timerEventDefinition>
</boundaryEvent>

<sequenceFlow sourceRef="reminderTimer" targetRef="sendReminder"/>

<serviceTask id="sendReminder" flowable:delegateExpression="${sendReminder}">
    <extensionElements>
        <flowable:field name="to" expression="${assignee}"/>
        <flowable:field name="subject" stringValue="Task Reminder"/>
        <flowable:field name="body" stringValue="You have a pending task awaiting your action."/>
    </extensionElements>
</serviceTask>

SendReminderDelegate Fields

Field Description
to Recipient email (can use expression like ${assignee})
toRole Send to all users in a role (e.g., ROLE_MANAGER). Can be combined with to.
subject Email subject line
body Email body text — the custom message that the workflow author writes

Auto-resolved context: The process name and current task name are automatically included in every email — no BPMN configuration needed. They are resolved at runtime from the Flowable engine and appear in the email template as structured fields above the message body.

Email format: Emails are sent as HTML using a Thymeleaf template. The language of the template labels (e.g., "Process", "Task", "Message") follows the system-wide language set in Admin → System Settings. The body text you write in BPMN is embedded as-is inside the template.