Skip to main content

Escalate an order when its review deadline expires

Start two orders. Complete the first as the regular reviewer. Leave the second claimed across a server restart and finish it as the senior reviewer.

BPMN example Duration Use
Order approval with deadline PT48H The 48-hour process. Complete it without waiting for the deadline.
Order approval with deadline, one-minute demo PT1M A separate process identity for trying timeout and recovery.

Build the TypeScript source distribution as in Getting started. Stop the in-memory Getting started server if it is still running. Start the local demo with a fresh SQLite file so the deadline survives shutdown. Keep this terminal in the source distribution.

Terminal window
GETRIEBE_SQLITE_PATH=./deadline-tutorial.sqlite pnpm start

Download run-workflow.ts. In a separate terminal, run it with Node.js 26.13.1. The command provisions the local senior-reviewer role and an account in that role. The account’s local demo password is senior-reviewer.

Terminal window
node run-workflow.ts deadline prepare

To watch the task in the browser, start the Worklist lab and sign in as reviewer with password reviewer before running the one-minute process.

Connect the Modeler to the server. Open the 48-hour file, select Review order, and choose Edit deadline. The Boundary Event sits on the task edge. Its Duration is PT48H.

To practice attaching the timer, make a copy of the 48-hour file. In the copy, remove the Boundary Event with its context-pad delete action. Then select Review order, choose Add deadline, and use the new timer’s Connect to other element action to connect it to Senior review. The copy already declares the senior-reviewer BPMN Resource and uses it as the senior task’s Potential owner role. Both review tasks map the approval result and feed the XOR merge before the order decision.

Choose Validate to inspect element diagnostics and Validate and deploy to store the model. Open and deploy the one-minute file as a second process. Export either file and reopen it to check its duration and timeout connection.

Getriebe accepts a fixed positive duration at millisecond precision. For example, use P1DT12H for 36 elapsed hours or PT0.5S for half a second. The Modeler writes the duration as a string literal in the Getriebe expression language. See the Boundary Timer profile.

Terminal window
node run-workflow.ts deadline normal

This starts the 48-hour process, claims Review order and submits approved: true. The process completes, and the senior reviewer receives no task. Completion can also win after the due time if the server has yet to process the timer.

Terminal window
node run-workflow.ts deadline wait

This starts the one-minute process and claims Review order as reviewer. Save the printed resume command and due time. Choose Refresh in the Worklist to see the deadline in your local timezone.

Stop the server with Ctrl+C while the task is still waiting. Once the printed deadline has passed, restart the server with the same SQLite path. Reload the Worklist and sign in again to see that the regular task is gone. To view Senior review, reload and sign in as senior-reviewer, or use a separate browser session. Leave it unclaimed for the helper. An authorized historical read still shows the previous task and its deadline.

Terminal window
node run-workflow.ts deadline resume INSTANCE_ID TASK_ID

The helper reads the regular task’s withdrawal event, prints its due and processing times, and completes the senior review through the HTTP API. The Worklist embedding lab shows and assigns work. The helper submits the approval result.

Try the two choices in the Cancel Activity diagram or inspect the runtime and recovery evidence.