Branch on the Outcome of a Task with Conditional Boundary Events
A conditional boundary event is attached to an activity and has a condition. When the condition is true, the process takes the path of the boundary event. Use it for outcomes such as Rejected, Cancelled, or Escalated: the label of the event says what happened, the condition says when.
Reference: BPMN Conditional Events explains the conditional event in the BPMN standard, and how it differs from a gateway.
When Flower Evaluates the Condition
Flower evaluates the condition once, when the work item of the activity is resolved. Changes to the work item while it is open do not trigger the event.
| Condition when the work item is resolved | Interrupting event | Non-interrupting event |
|---|---|---|
| true | The process takes the path of the event instead of the normal outgoing flow | The process takes the path of the event and the normal outgoing flow |
| false | The normal outgoing flow | The normal outgoing flow |
To react while the work item is still open, use a timer or an escalation. How this differs from the BPMN standard is explained in BPMN Conditional Events.
Choose a Status or Resolution
For the outcome of a task, you need no expression. Select the boundary event, and in the properties panel open the group Condition. Besides the condition expression, it offers two lists of checkboxes:
| List | Offers | The condition is true when |
|---|---|---|
| Status of the work item | The statuses of the work type of the activity | The work item is in one of the checked statuses |
| Resolution of the work item | The resolutions of your Jira site | The work item has one of the checked resolutions |
The work item that counts is the resolved work item of the activity the event is attached to. The statuses come from the work type of this activity, else from the work type of its swimlane, else from the default work type of the Flower settings. The resolutions are one list for the whole Jira site, maintained by a Jira admin in the Jira settings.
- Within one list, one checked value is enough. With Won’t Do and Declined checked, either resolution makes the condition true.
- With a choice in both lists, both must fit. With status Closed and resolution Won’t Do checked, the work item must be closed and resolved as Won’t Do.
- The expression counts only when nothing is checked. While a status or resolution is checked, the field of the condition expression is greyed out and ignored.
- Upper and lower case, accents, and apostrophes do not matter. Won’t Do is the same as won’t do.
- A status or resolution that Jira no longer has stays visible in the list, because it is kept in the model.
The choice is stored in the BPMN XML in the attributes flower:conditionStatus and flower:conditionResolution, as names separated by commas. A status or resolution whose name contains a comma cannot be chosen; use an expression for it. The details are in Choose a Status or Resolution.
Write the Condition as an Expression
For any other condition, such as the priority or a field of the process instance, write an expression, the same as on the outgoing transitions of an XOR gateway (learn how to write expressions). In a boundary event, these variables are available:
| Variable | Contains |
|---|---|
cur | The resolved work item of the activity the event is attached to |
pi | The process instance |
The fields of a work item are under fields, for example cur.fields.status.name.
Examples:
| Event label | Condition |
|---|---|
| Rejected | ${cur.fields.resolution.name == 'Rejected'} |
| Cancelled | ${cur.fields.status.name == 'Cancelled'} |
| Escalated | ${cur.fields.priority.name == 'Highest'} |
| Big order | ${pi.fields.customfield_10050 > 10000} |
Use the status and resolution names of your Jira. A field without a value makes the condition false. For the first two rows, checking the status or resolution in the lists above is simpler.
Model the Event in the Editor
- Drag an intermediate event onto the edge of the activity.
- Use the wrench icon to change it into a conditional boundary event, interrupting or non-interrupting.
- Give it a label, for example Rejected.
- In the properties panel, open Condition. Check the statuses or resolutions in Status of the work item or Resolution of the work item, or enter an expression in Condition Expression when nothing is checked.
- Connect the event to the activity that should follow.
Example: Approval
A conditional boundary event is a compact way to model an approval: the approval activity gets an interrupting conditional boundary event Rejected with the resolution Rejected checked (or the expression ${cur.fields.resolution.name == 'Rejected'}). Its path leads back to the work. Every other resolution continues on the normal outgoing flow. You do not need an XOR gateway after the approval activity.
What’s Next?
-
BPMN Conditional Events: The conditional event in the BPMN standard, with all its positions.
-
End a Task with an Error Status: An error boundary event for a work item that is cancelled or rejected.
-
Make Approval Steps: The approval pattern with an XOR gateway or a conditional boundary event.
-
Set Jira Due Dates with Timer Events: Timer boundary events for reminders and escalations.