Skip to main content
Version: 1.28 (Current)

Timers, Events and Waiting New in 2

Audience: Low-code Engineers

Skill Prerequisites: Workflows, Tokens

General Description​

A wait is a step where a BPMN 2.0 workflow stops until something happens. A run can wait at:

Waits go at the top level of the workflow: not inside a subprocess, and not on the paths of a parallel gateway, between the split and its join. The editor offers them only at the top level and marks a wait on a parallel path, and saving refuses both.

What happens at a wait​

  1. When every path of the run has ended or waits, the run is saved with its tokens and lists, as the wait's settings say. See What a run keeps while it waits.
  2. The call that started the run ends. Its caller gets the run's id and the status Waiting. See Calling a workflow that waits.
  3. When the wait is over, the run continues in the background, as the user who started it, until it ends or waits again. Timers are checked every 30 seconds; an event or a completed task usually moves the run on within moments.

A saved run survives restarts of the site. It stays on the version of the workflow it started on, to its end, even after you change the workflow. The runs that wait are listed in the History tab.

Timers​

A timer waits for a duration, or until a moment, then the run goes on.

  1. Select an element at the top level and choose Add Wait. The timer is added after it and its dialog opens.
  2. Choose After or At, set the time, and choose what the run keeps while it waits.
  3. Select OK. Cancel removes a new timer.

Timer Settings, or a double-click on the timer, opens the dialog again.

The timer dialog, set to wait After 5 minutes, with the While waiting, keep options and Max size (MB)
SettingDescription
AfterWaits this long, from when the run reaches the timer. Enter a number in Wait for and a Unit: minutes, hours, days or weeks.
AtWaits until this Date and Time. A moment already past fires at once.
Use a token or expression insteadReplaces the fields with one text box. For After, a token whose value is how long to wait, such as [TaskType:ReminderAfter]. For At, a token whose value is a date and time, such as [Contract:StartDate]. The tokens are read when the run reaches the timer.
While waiting, keep and Max size (MB)What the run keeps while it waits here. See What a run keeps while it waits.

Times are read in the site's time zone. The timer is named after its time, such as Wait 5 minutes or Wait until 15 Dec 2026, 09:00, unless you give it a name of your own.

Durations and moments from tokens. A duration can be written as words, such as 3 days, 2 hours 30 minutes or 90 min, or in ISO 8601, such as P3D or PT2H30M. Days, weeks, months and years keep the time of day in the site's time zone; hours, minutes and seconds are elapsed time. A moment can be written as 2026-12-15 09:00, read in the site's time zone, with a time zone offset, used as it is, or in the site's date format. A date alone means midnight. A text the timer can't read stops the run, for example with The timer "Reminder" couldn't read "soon" as a duration. Write it like 3 days, 2 hours or 30 minutes.

A timer that's already due doesn't wait. When the moment of an At timer has passed, the run goes on through the timer in the same call.

A timer fires up to 30 seconds after it's due, when the next check runs. In a test, Fire now fires it at once. See Testing and Debugging.

To put a time limit or a reminder on a person's task, rather than pause the run, use a deadline or a reminder on the task's border.

Deadlines and Reminders​

A timer on the border of a user task or a call activity acts while the run waits there:

KindWhen it fires
DeadlineThe task is cancelled, or the called run is cancelled with the runs it waits for, and the run goes on along the timer's path instead. A deadline fires once.
ReminderThe timer's path runs beside the task, for example to send a reminder email, and the task goes on waiting. A reminder can fire once, or again and again at an interval until the task ends.

Drawn on the diagram, a deadline has a solid outline and a reminder a dashed one.

  1. Select a user task or a call activity at the top level and choose Add Deadline / Reminder. The timer is added to its border and the Deadline / Reminder dialog opens.
  2. Choose when it fires:
    • After: this long after the task starts waiting.
    • At: at this date and time. A moment already past fires at the next check.
    • Every: again and again at this interval until the task ends, such as every 2 days. Only for a reminder.
  3. Under When it fires, choose Keep the task for a reminder, or Cancel the task for a deadline.
  4. Select OK, then connect the timer to what happens when it fires.

Timer Settings, or a double-click on the timer, opens the dialog again. As for any timer, Use a token or expression instead reads the time from a token, such as [TaskType:RemindEvery]. The timer is named after its time, such as Remind every 2 days, Remind after 2 hours, Deadline after 10 days or Deadline at 15 Dec 2026, 09:00, unless you give it a name of your own.

What happens first wins. When the task is completed before its deadline, the run goes on as usual and its timers are dropped. When the deadline comes first, the run takes the deadline's path, and the task, cancelled as the system, has nothing to go back to.

Reminders. A reminder's path runs beside the task, so nothing on it can wait: saving refuses a timer, a wait for an event or a user task on it. A reminder that repeats fires again one interval after it last fired. Reminders missed while the site was down aren't sent afterwards.

A call activity has deadlines and reminders only when the workflow it calls waits. A call that ends within its step has nothing to time.

On the run's diagram. In the History tab, a run waiting at the task shows Next reminder in 52 s and Deadline in 1 min 38 s on the task, and Reminder fired 2 times or Deadline fired once they have. Monitoring's Stuck figure counts an overdue deadline or reminder like any timer.

In a test, Fire now fires the timer due first, one per click. A test creates no task, so a deadline in a test cancels nothing.

A deadline or reminder on the diagram acts on the process. The task type's own due date and escalation steps act on the task, whatever process it belongs to. Both can be used together.

A wait for an event has an SLA instead, set in its own dialog.

Events​

An event is a name, an optional key and a payload of values. One part of the application raises it, and the BPMN 2.0 runs that wait for it continue, or the workflows that start on it start. For example, the After workflow of the Order transition raises Purchase request ordered with the request's id as the key, and the Purchase follow-up run for that request continues.

  • The name connects the workflows that raise and receive it. Events belong to the site they're raised on.
  • The key says which run the event is for, such as a record's id. With a key, the event reaches the one run that waits for that name and key. Without a key, it reaches every run that waits for that name without a key.
  • The payload is a list of names and values. Each value is set as a token of that name on the run that continues, replacing a token of the same name. Values are text.

Waiting for an event​

  1. Select an element at the top level and choose Add Wait for Event. The event dialog opens on its Event tab.
  2. Enter the Event name, and a Key if the event is for one run, such as [PurchaseRequestId]. The key is read when the run reaches the wait. A key that's empty at that moment means the run waits for the event without a key.
  3. Choose what the run keeps while it waits.
  4. To limit how long the run waits, set an SLA on the SLA tab. See SLA of a wait for an event.
  5. Select OK.

Event Settings, or a double-click, opens the dialog again. The element is named after the event, such as Wait for Purchase request ordered, unless you give it a name of your own.

The Event tab of a Wait for event's dialog, with the Event name, the Key and the While waiting, keep options, and the SLA tab beside it

How an event reaches a waiting run:

  • With a key, it reaches the run that waits for that name and key, the one that started waiting first. When no run waits yet, the event is kept for 7 days from when it was raised. A run that reaches the wait in that time receives it: the run is still saved at the wait, and continues moments later.
  • The same name and key raised again does nothing while the first one is kept, received or not, unless a run waits for it at that moment. Repeated callbacks are harmless.
  • Without a key, it reaches every run waiting for it at that moment. A run that reaches the wait later doesn't receive it.

Raising an event​

An event is raised by the Raise Event action, in any action list on either engine, or by an element on a BPMN 2.0 diagram:

  • Add Raise Event raises the event, and the path goes on.
  • Add Raise Event and End raises the event, then ends its path.

The dialog has the Event name, the Key, and the Payload: rows of Name and Value, added with Add. Values can hold tokens, such as [Total]. The element is named after the event, such as Raise Purchase request ordered.

Raising never waits, so these elements can go anywhere, also inside a subprocess and on the paths of a parallel gateway. The event is raised as the run's user. The runs it reaches continue in the background, never inside the run that raised it.

Starting on an event​

A workflow can start when an event is raised, instead of being called.

  1. Select the start event at the top level and choose Start on Event.
  2. Choose Start on this event, enter the Event name, and select OK. The start event takes the event's name.

To go back, open Event Settings on the start event and choose Start with a plain start event.

  • Inputs. The event's payload fills the workflow's inputs of the same name. Other values are left out. A List input gets an empty list, and a missing required input fails the start.
  • Who and when. The workflow starts in the background, moments after the event is raised, as the user who raised it. It runs until its end or its first wait, like any run.
  • Which events start it. An event without a key starts every workflow that starts on it. An event with a key starts them only when no run is waiting for that name and key; the start then uses the event up, and no later wait receives it.
  • Failures. A start that fails is written to the log and isn't tried again. The workflow can still be called through its Execute action and tested with the Test button. A subprocess can't start on an event: The subprocess "Collect quotes" starts on an event. A subprocess starts with a plain start event; to start on an event, use a workflow of its own.

Waiting for the first of several​

An event-based gateway waits for whichever of several timers and events comes first, for example the delivery or a 5-minute timeout.

  1. Select an element at the top level and choose Add Event-Based Gateway.
  2. On the gateway, add a path for each thing it waits for with Add Wait or Add Wait for Event. It needs at least two.
  3. Continue each path from its timer or wait for event.

The run waits at the gateway for all of them at once. The first one to happen takes its path, and the others are dropped. A timer that's already due when the run arrives takes its path at once.

Each path leads straight to a timer or a wait for an event, with no condition, and nothing else leads to that timer or wait. Otherwise saving fails with The event-based gateway "Delivered or late" must lead only to timers and waits for an event, each with no other incoming flow and no condition on its flow.

A wait for an event on a path of the gateway has no SLA of its own: the gateway's timers set how long it waits. The only exception is the late path an SLA draws.

SLA of a Wait for an Event​

A wait for an event can have an SLA (service-level agreement). It sets how long the wait may take, adds steps that remind someone or escalate before, at or after that due time, and decides what happens if the event doesn't come in time. For example, the Ordered wait of Purchase follow-up may take 2 days. One day before that, a workflow reminds the Buyers. At the due time, the run takes a late path that hands the order to the Procurement Leads.

The steps work like a task type's escalation steps, but they act on the process instead of a task.

  1. Open the wait's Event Settings and select the SLA tab.
  2. Select Time this wait with an SLA.
  3. Set Due after, add the Steps, and choose what happens At breach.
  4. Select OK, and save the workflow.
The SLA tab of a Wait for event: due after 2 days, a step 1 day before the due time that runs the workflow Remind the buyers about the order, and Take a late path selected under At breach
SettingDescription
Due afterHow long the wait may take, counted from when the run starts waiting here. Enter a number and a Unit: minutes, hours, days or weeks. A new SLA is due after 1 hour.
Use a token or expression insteadReplaces the fields with Due after (token or expression), read when the run starts waiting. The value is a duration, such as 3 days or PT2H, or a token that holds one, such as [PaymentTerm]. A value that can't be read stops the run at the wait with The SLA of "Wait for Payment confirmed" has a due time that can't be read. Write a duration such as 2 hours or 3 days.
StepsAdd step adds a step after the others. A step runs How long (a number and a Unit) before the due time or after the due time, or runs at the due time. Under Does, choose Run a workflow and the Workflow, or Raise an event with its Event name and Key. A new step runs 30 minutes before the due time.
Then everyOn the last step only: runs it again at this interval while the run waits.
At breachWhat happens at the due time: Keep waiting: the steps after the due time still run, Take a late path: the run leaves the wait at the due time, or Fail the run at the due time.

The steps go in time order. Only the last one can repeat.

At breach​

  • Keep waiting. Only the steps happen at the due time. The run waits for its event however long it takes, and the steps after the due time run, with the last one repeating if it's set to.
  • Take a late path. On OK, the editor puts an event-based gateway named In time? before the wait. Its second path has a timer named after the due time, such as Late after 2 days. Connect the timer to what happens when the wait is late. Until you do, the editor's checks mark it with "Late after 2 days" has no outgoing flow. Connect it to the next step or to an end event. The run waits for whichever comes first: the event takes the usual path, and the timer takes the late path. The timer holds the due time, so change the timer to change it.
    • A late path needs the wait to have a single incoming flow. Otherwise the tab says A late path needs "Wait for Purchase request ordered" to have one incoming flow, so the gateway can go before it. Join its incoming flows first, or choose another breach.
    • Choosing another breach removes a late path whose timer isn't connected yet. Once the timer leads somewhere, delete the timer and the gateway yourself.
  • Fail the run. At the due time, the run fails at the wait with "Wait for Purchase request ordered" didn't get its event by the due time of its SLA (2026-11-25 09:00 UTC), so the run failed, as its SLA says. No error event catches this failure. The run is listed as Failed in the History tab, where you can cancel it.

With a late path or Fail, the wait ends at the due time. A step after the due time could never run, so saving refuses one.

The Ordered wait after Take a late path: an event-based gateway named In time? before it, and the timer Late after 2 days on its second path, marked by the editor's checks until it's connected

What a step does​

  • Run a workflow. The step runs a workflow on the Wait SLA contract, for example one that emails the Buyers or creates a task for the Procurement Leads. The Workflow list offers only the workflows on that contract. When there are none, the tab says No workflow implements the Wait SLA contract yet. Create one on that contract to run it from a step, or raise an event instead. The workflow runs as the system, with no user, and the Tasks actions it calls act as the system. Its inputs say which run, wait, step and due time it runs for. The token [WorkflowName] holds the name of the waiting run's workflow.
  • Raise an event. The step raises the event with no user. The payload has the same values as the contract's inputs. The Key can hold tokens, such as [PurchaseRequestId], which are read when the run starts waiting.

How an SLA runs​

  • Real runs only. The clock starts when a real run starts waiting at the wait. A test run has no SLA clock: no step runs, and the test doesn't fail at breach. A late path's timer is an ordinary timer, so Fire now fires it in a test.
  • One step at a time. Steps are checked every 30 seconds, with the timers, and run in order, one step for each wait at each check. A step can run up to 30 seconds after its time, and steps due at the same moment run on consecutive checks.
  • Failures. A step that fails is tried again at the next check. After 3 failed attempts it's skipped, and the steps after it still run. The log records each step that runs, fails or is skipped.
  • The event comes. The wait ends, and its SLA with it: steps that aren't due yet don't run.
  • Versions. The SLA is part of the workflow's logic, so changing it raises the version. A run keeps the SLA of the version it started on.

What saving checks​

The editor's checks and saving refuse an SLA that can't work, with messages such as:

MessageMeans
The SLA of "Wait for Purchase request ordered" has no due time. Set how long the wait may take.Due after is empty.
Step 2 of the SLA of "Wait for Purchase request ordered" comes before step 1. Put the steps in time order.The steps aren't in time order.
Step 1 of the SLA of "Wait for Purchase request ordered" repeats, but only the last step can repeat.A step other than the last repeats.
Step 2 of the SLA of "Wait for Purchase request ordered" runs after the due time, when the run has already taken the late path. Run it before or at the due time, or keep waiting at breach.A step after the due time with a late path. With Fail, the message ends …when the run has already failed.
Step 1 of the SLA of "Wait for Purchase request ordered" runs a workflow that doesn't exist or doesn't implement the Wait SLA contract. Choose one of the contract's workflows.The step's workflow was deleted, or moved to another contract. Importing a workflow doesn't check this, since the step's workflow may be imported later.
"Wait for Purchase request received" is a path of the event-based gateway "Delivered in time?", which waits for whichever of its events and timers comes first, so the wait can't have an SLA of its own. Remove the SLA, or take the wait out of the gateway.The wait is on a path of an event-based gateway.

Waiting for a called workflow​

A call activity at the top level that calls a workflow that waits, waits with it. The called workflow runs as its own run, listed in the History tab as called by #9. When it ends:

The called runThe call activity
CompletesGoes on. The called workflow's outputs come back as its Execute action's settings map them.
FailsIts error goes to the call activity's error events, by its code, with the called workflow's message in [ExceptionMessage]. Otherwise the run fails too.
Is cancelledThe call activity's error events see the code Cancelled.

The Execute action's own On Error and Continue On Error don't apply to a failure that comes after the wait.

Inside a subprocess, a call activity doesn't wait: it starts the called run and goes on, like an Execute action. On the path of a parallel gateway, a call to a workflow that waits fails the run with The call activity "Ask manager" is on a branch of the parallel gateway "Split" and the workflow it calls can wait, which nothing on a branch can do yet. Move it before the parallel gateway or after its join.

Calling a workflow that waits​

Each BPMN 2.0 workflow has a wait behavior, worked out from its diagram when you save it and shown in the engine bar:

Wait behaviorWhenWhat its Execute action gives back
Finishes in the callNo wait can be reached. Workflows on the current engine, and workflows just upgraded, finish in the call.Its outputs, as always.
May waitSome paths reach an end without a wait. A timer At a moment, or After a duration from a token, counts here even on a path that has no other wait.The run's id and status, and the outputs when the status is Completed.
Always waitsEvery path from the start to an end passes a wait.The run's id and status. The action has no output settings.

When a workflow can wait, its Execute action gets two more settings and a note that says what the call does:

SettingDescription
Store instance id inThe name of the token that receives the id of the workflow's run, when it waits.
Store status inThe name of the token that receives the status: Waiting, or Completed when the workflow ended in the call.

An Execute action ends its call at the workflow's first wait, and the actions after it go on. To wait for a workflow and use its outputs, call it from a call activity at the top level of a BPMN 2.0 workflow. The Run Workflow token has no settings for the run's id and status: use it only with workflows that finish in the call.

When the behavior changes. If a save changes what the workflow does when it's called, and something calls it, a dialog titled What the workflow does when called changes says what the workflow will do and lists the callers of its Execute action, such as forms, form buttons, APIs, scheduler jobs and other workflows, with a note on calls inside a subprocess. Save anyway saves; Cancel doesn't. Check those callers after you save: they now get what the new behavior gives back.

What a run keeps while it waits​

A run keeps its tokens and lists until it ends, also while it waits. Each timer and each wait for an event has these settings:

SettingDescription
While waiting, keepEverything (the default), Everything except… the tokens and lists you list, or Only these… tokens and lists. Add each one as a Token or a List by its name.
Max size (MB)The most the run may hold while it waits here. Empty uses the default, 10 MB.

The workflow's inputs and outputs are always kept. When a run waits at several places at once, it keeps everything any of them keeps, under the largest of their limits. A user task has no such settings in the editor: it keeps everything, up to 10 MB.

  • Over the limit, the run stops at the wait with an error and nothing is saved, for example The workflow couldn't wait at "Wait 5 minutes": it holds 14.2 MB and the limit is 10 MB. The largest items are the list ImportRows (13.8 MB) and the token ApiResponse (0.3 MB). Keep fewer items at this wait, or clear what you no longer need before it.
  • Above 1 MB, the run is saved with a warning in the test panel and the log.
  • Live objects, such as open streams or connections, can't be saved. They're left out, with a warning that names them.
  • Values come back with their type when they're text, numbers, dates, yes/no or JSON. Other objects come back as JSON.
  • Lists are saved as copies. After the wait, the run's list and the caller's list are separate.
  • Records are better kept as ids. A token that holds a record's id stays small, and reading the record after the wait gives its current values.

Restarts and failures​

Waiting runs are saved in the database, so a restart doesn't lose them: the next check after the site starts continues the runs that are due.

A run that was running a step when its server stopped can't be continued safely, since the step may have already sent an email or written a record. After 5 minutes without a sign of life from its server, it's marked Failed at its last saved position. The engine never runs the step again on its own. Check what the step did, then cancel the run in the History tab.

Considerations​

  • No wait for a lifecycle state. Waiting until a record reaches a state of its lifecycle isn't available yet. Raise an event from the transition's After workflow and wait for that event instead.
  • Which waits have a time limit. A user task or a call activity can have a deadline or a reminder on its border, and a wait for an event can have an SLA. A timer is its own time limit. A wait on a path of an event-based gateway has neither: give the gateway a timer path instead.
  • SLAs aren't shown on a run yet. The History tab's run diagram and Monitoring don't show a wait's due time or the steps its SLA ran. The log records them.
  • A repeating step raises an event with a key only once. As for any event, the same name and key raised again does nothing while the first one is kept, for 7 days. To remind again and again, run a workflow, or raise the event without a key.
  • Who can raise an event. Raising has no permission check of its own. Anyone who can run an action list that raises the event can continue the runs waiting for that name and key. See Raise Event.
  • Tests and real runs don't mix. An event raised in a test run reaches only test runs and starts no workflow, and a real event never reaches a test run.