Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 44 Next »

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 : 

  1. Select the check box Run this post-function only if a condition is verified.
  2. Type a Nunjucks template that returns either true or false.

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

(lightbulb) A tester creates an issue. The created issue should be automatically assigned to the Product Owner, only if the issue is a BUG.

 Steps
  • Create a Product Owner project role, with the product owner as the only member.
  • Add the Assign to role member post-function to the Create transition of the issue workflow.
  • Select Product Owner as the project role.
  • Select the check box Run this post-function only if a condition is verified.
  • Type the following code in Condition.

    {{ issue.fields.issuetype.name == "Bug" }}

(lightbulb) Automatically escalate an issue if it is being raised with a "Blocker" priority.

 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.

    {{ issue.fields.priority == "Blocker" }}


  • Place this post-function at the end in the list of post-functions.

(lightbulb) Automatically transition the Epic when all Stories are resolved.

 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.

    {% 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.

(lightbulb) 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".

 Steps
  • Add the Copy value from field to field post-function to the Close transition of the issue's workflow.
  • Select the Single version picker in the From field.
  • Select the Fix Version/s in the To field.
  • Select the check box Run this post-function only if a condition is verified.
  • Write the following content in the Condition section.

    {{ issue.fields.resolution.name == "Fixed" }}

(lightbulb) Assign a Bug to a Product Manager only when its priority is Critical

 Steps
  • Add the Assign to role member post-function to the transition of the issue's workflow.
  • Select Product Managers as the Project Role.
  • Select Conditional execution and write the following condition:

    {{ issue.fields.issuetype.name == "Bug" and issue.fields.priority.name == "Critical" }}

(lightbulb) 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

 Steps
  • Add the 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:

    {{ issue.fields.priority.name == "High" or issue.fields.priority.name == "Highest" or issue.fields.reporter | isInRole("Service Desk Customers")}}
  • No labels