BPMN Gateway & decision handling
Never let indecision slow you down again.
Recurring decisions can be easily automated with BPMN gateways. Here you learn how to craft expressions that enable confident and automated decision-making in Jira.
Expressions with Jira Smart Values
As soon as the process execution reaches a BPMN gateway, a decision is due. The Flower BPM engine can make this decision for you based on the underlying expression.
The way in which Flower Expressions are evaluated is based on Jira Smart Values (opens in a new tab).
The expression is stored on the transitions coming from the gateway, as illustrated in the following image:
The process is executed via the transition for which the expression is true. The expressions can contain all field and property values from
- the current process instance (pi)
- the current activity (cur)
- the issue property (flower-variables)
If one of the transitions loops back, as in this example, to an activity that has already been completed, it is reopened again. Provided your Jira workflow configuration allows this.
Jira Smart Values
Smart values (opens in a new tab) allow you to access issue fields within Flower Expressions.
They are also used for Jira Automations (opens in a new tab) and can add significant power and complexity to your rules.
For example the smart value pi.fields.summary
prints the summary of your curren process instance.
Examples
The following examples provide a good overview of how Flower makes gateway decisions:
# | Expression |
---|---|
1 | pi.fields.summary == 'new Issue' |
2 | cur.fields.status.name == 'Reject' |
3 | cur.fields.priority.name == 'Low' |
4 | cur.fields.assignee.accountId == '557058:fc60faa5-f40d-4344-ae2b-4becd42a7914' |
5 | cur.fields.customfield_10113 >= 5000 |
6 | pi.properties.flowerVariables.external.data.value >= 1000 |
7 | pi.fields.comment.comments[0].accountId == '557058:fc60faa5-f40d-4344-ae2b-4becd42a7914' |
External data source integration
If your gateway decision does not depend on Jira fields, but on external data, you can write these as JSON to the process instance. There is a Jira Cloud REST (opens in a new tab) service to store so-called Jira issue properties on Jira tickets. You can then access this JSON data in the expressions. In the following example, we write the value {"some": "value"} to the process instance with the key FLOWER-2 and the property name 'flowerVariables':
curl --request PUT \
--url 'https://your-domain.atlassian.net/rest/api/3/issue/FLOWER-2/properties/flowerVariables' \
--user '[email protected]:<api_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"some":"value"}'
The JSON data can of course be as complex as you like, but must not exceed 32768 bytes. You can then access it in the BPMN transition as follows:
pi.properties.flowerVariables.some=='value' //returns true