Versions Compared
Version | Old Version 1 | New Version 2 |
---|---|---|
Changes made by | ||
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
PostMost post-functions are provided with an option to control their execution with the include an option for Conditional execution setting. Nunjucks templates are used to determine . Aside from the transition in which you include a post-function, this enables you greater control over the specific circumstances for when a post-function will execute; will (or will not) trigger. To configure Conditional Execution, you use the Condition field (Figure 1, right) and with Nunjucks templates; create a Nunjucks template that evaluates to true
(or a truthy value) and the post-function will either be executed (or skipped, if you choose the Reverse option).
To add a condition to control the execution of the Conditional Execution to a post-function :
Select the check box Run this post-function only if a condition is verified.
Type Enter a Nunjucks template that returns either
true
orfalse
, as needed by your post-function logic.
Expected value in the Nunjucks template
The value returned by your Nunjucks template should be either a boolean value (true
or false
), or more generally any text that will be interpreted as either "truthy" or "falsy".
Text: Any text will be interpreted as "truthy" (the equivalent of true
) except for a :
A string with a literal value of
false
, an ‘false’
An empty string
Or a string consisting only of whitespaces
For example, the following text will be values are considered as "truthy":
true
1
A string
[Object object]
[]
Boolean logic operators: You can use traditional boolean logic operators, such as or
, and
and not
, to combine conditions. You can also use parentheses to group expressions. For example:
{{ 1 == 1 or 1==2 }}
{{ issue.key == 'TEST-1' and issue.fields.subject == 'Do it' }}
{{ true and (false or true) }}
{{ not 1==1 }}
{{ issue.fields.description is null }}
returnstrue
if the issue has no description{{ issue.fields.assignee is not null }}
returnstrue
if the issue has an Assignee
Examples of Nunjucks expressions returning a "truthy" value:
{{issue.fields.assignee}}
if the issue is assigned{{issue.fields.assignee.accountId == "accountId:557058:8952dfd1-85c4-493f-87d8-d383b987e05c"}}
if the issue is assigned to the user whose accountId is "557058:8952dfd1-85c4-493f-87d8-d383b987e05c"{{issue.fields.description is not null}}
if the issue's description is not empty{{issue.fields.assignee and issue.fields.status.name == "In Progress"}}
if the issue is assigned and in the “In Progress” status
Sample use cases for Conditional execution
A tester creates an issue. The created issue should be automatically assigned to the Product Owner, only if the issue is a BUG.
Expand | ||
---|---|---|
| ||
|
Automatically escalate an issue if it is being raised with a "Blocker" priority.
title | Steps |
---|
Add the Transition issue post-function to the Create transition of the issue's workflow.
Input the transition name or ID of the transition that escalates the issue.
Select the check box Run this post-function only if a condition is verified
.
Write the following content in the Condition
section.
Code Block |
---|
{{ issue.fields.priority == "Blocker" }} |
Place this post-function at the end in the list of post-functions.
Automatically transition the Epic when all Stories are resolved.
title | Steps |
---|
Add the Transition current issue post-function to the Resolve transition of the Story workflow.
Input the transition name or ID of the Resolve transition.
Select the check box Run this post-function only if a condition is verified
.
Write the following content in the Condition
section.
Code Block |
---|
{% set stories = issue | epic | stories %}
{% set trigger = true %}
{% for story in stories %}
{% if story.fields.status.name != "Resolved" %}
{% set trigger = false %}
{% endif %}
{% endfor %}
{{ trigger }} |
Place this post-function at the end in the list of post-functions.
Copy value from a Single Version Picker select list to the Fix Version(s) field if the resolution provided while closing the issue is "Fixed".
Expand | ||
---|---|---|
| ||
|
Assign a Bug to a Product Manager only when its priority is Critical
Expand | ||
---|---|---|
| ||
|
Transition an issue to In Progress status when the issue is either of High priority or the reporter of the issue belongs to Service Desk Customers Project role
title | Steps |
---|
Transition issue
post-function to the Create transition of the issue's workflow.Select Start Progress
as the transition to be triggered.
Select Conditional execution
and write the following condition:
Code Block |
---|
{{ issue.fields.priority.name == "High" or issue.fields.priority.name == "Highest" or issue.fields.reporter | isInRole("Service Desk Customers")}} |
Link issues that belong to the project with key “BACKEND” and created before 5 days
title | Steps |
---|
Link issues to current issue
post-function to the transition of the issue's workflow.Input the JQL expression as:
Code Block |
---|
project = "BACKEND" |
Select the “Filter Expression” and input the following condition
For examples on how to use Conditional execution within post-functions, please see Conditional Execution Samples.
Info |
---|
You are viewing the documentation for Jira Cloud. |
On This Page
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
.png?version=1&modificationDate=1716918689788&cacheVersion=1&api=v2&width=680)