Post functions are provided with an option to control their execution. You need to input a Nunjucks template in the Condition
field, and based on the result of that expression, the post-function will either be executed or skipped.
To add a condition to control the execution of the post-function :
- Select the check box
Run this post-function only if a condition is verified
. - Type a Nunjucks template that returns either
true
orfalse
.
Note that any non-empty string that is not false
will be considered as true
and will thus let the post-function run.
For information on how to insert Nunjucks annotations see, How to insert information using Nunjucks annotations. You can use the Nunjucks tester to test your templates against any issue.
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.
Automatically escalate an issue if it is being raised with a "Blocker" priority.
Automatically transition the Epic when all Stories are resolved.
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".
Assign a Bug to a Product Manager only when its priority is Critical
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