Condition templates

Introduction

So, you've already known what the templates are. How about getting deeper? Let us show you the real power of our plugin. Let's start with conditions templates. What are the conditions in the first place? Conditions control whether a transition should be executed. They operate before the action will actually happen - preventing or allowing the execution.

Adding conditions to the workflow is a challenge itself, not to mention how time-consuming it is. Especially when you have hundreds of transitions and complex workflows. Some of these conditions remain basically the same and yet they have to be entered. And this is were Workflow PowerBox comes in handy giving you a possibility to gather all parameters in one place, save it as a template and then re-use it wherever you want!

Contents:


Creating a new template

Templates are useful as they make your work easier and faster. But how to use them? Let's create your very first condition template!

To start with, you have to have the Jira Administrators global permission

Creating a template is possible for any user that has the Jira Administrators' permission. The administration panel where you can create a template is located in the Workflows Section.

Use a Keyboard shortcutg + g + start typing condition templates

 

Now you will be redirected to the Condition Templates page where you have all condition templates listed in one place. Note that they are grouped into two categories: Active and Inactive. In order to add a new template click the Add Template button. The dialog displays the Template's Name and Description fields (both fields can be changed later on).

Fill in the fields and confirm with the Add button. Your template is now created!

Inactive Template

Shortly after creating a new template you will notice it on the list of existing templates. By default, it will get an inactive status. That's because it is not associated with any transition in any active workflow. 


Active Template

As soon as you associate your template with a workflow's transition it will become active. Note that any changes made on an active template will require a publishing draft.


Adding Conditions to a Template

Creating a template is just the beginning. The next and most important step is to adjust it to your needs. You can define your template by adding desired conditions. You can construct complex conditions by grouping and nesting them. It allows you to create dependencies that will help you in your work. Moreover, you can toggle the logic for how the conditions in a group are applied between All and Any as shown below.


 

You can always make any proper changes in the same panel by clicking Edit a condition template. When you are editing an active template you are actually editing a draft. Please remember to publish this draft after making any changes.

How to construct conditions?

You can smoothly manage newly created conditions. Next to each of them, you will find a panel with four buttons that allow you to fire a particular action.


 set condition to: must fail/pass

 add grouped condition

 edit

 delete


Executing a template

Executing a template means nothing more than adding a template to the chosen transition in a workflow. As soon as you have all workflows listed you have to select one of them and click the Edit button in the Operations section. You will be redirected to the Edit Workflow page where you can see all transitions that take place as shown below:

Click the desired transition and then choose which of the workflow elements you want to extend (conditions, validators or post functions) with a predefined template.
From the list of conditions choose the Run Condition Templates option. Choose a previously created predefined template you want and add those parameters to your condition.

Your template will be added to the list of conditions that will run for this particular transition.

Remember to publish the draft of a workflow so your changes will be considered.

From now on your template will change its status from inactive to active. You can also check which workflows are associated with this template


Disabling a template

You can disable your template at any time.

  1. Log in as a user with the Jira Administrators global permission.
    Choose   > Issues. Select Workflows > Condition Templates to open the Condition Templates page.
    (info) Tip: Use a Keyboard shortcutg + g + start typing condition templates
  2. Choose the desired template and select the View or Edit button. You will be redirected to the Template Page
  3. Click the disable button. From now on your template will be disabled in all associated workflows. Remember that disabling/enabling template doesn't require publishing, so you can disable a template without publishing it.
  4. Note that a disabled template doesn't allow you to check any underlying condition. You can still control what happens if a user tries to execute a transition with a disabled template.
  5. You can enable your template at any time by clicking the Enable button.

Conditions template options

A conditions template has several options that can be configured.

You can configure plugin options for each type of template separately. Condition templates options are listed below.

OptionPossible valueDescription
Template is disabledPass conditionA disabled template works as the "always true" condition without checking the template content.

The template has been disabled by an administrator, and no condition check against the template will be performed

Fail conditionA disabled template works as the "always false" condition, without checking the template content.

Throw exceptionAn error is raised and logged to a standard Jira log file. The workflow transition cannot be executed.
A template is not foundPass conditionAn invalid or deleted template works as an "always true" condition.
A template was deleted or cannot be found for any other reasonFail conditionAn invalid or deleted template works as an "always false" condition.

Throw exceptionAn error is raised and logged to a standard Jira log file. The workflow transition cannot be executed.
Template is emptyPass conditionAn empty template works as the "always true" condition.
The template contains no conditionsFail conditionAn empty template works as the "always false" condition.

Throw exceptionAn error is raised and logged to a standard Jira log file. The workflow transition cannot be executed.
Condition checkingOptimized condition checkConditions are checked until it's clear that the transition can/cannot be executed and then the remaining conditions are omitted.
Method of condition checkingFull condition checkAll conditions in a template are checked regardless of the template logic.

Importing templates

  1. Log in as a user with the Jira Administrators global permission.
    Choose   > Issues. Select Workflows > Condition Templates to open the Condition Templates page.
    (info) Tip: Use a Keyboard shortcutg + g + start typing condition templates
  2. Click the Import button.
  3. Choose the XML file you want to upload and then accept your choice with the Import button.

Exporting templates

Already created templates can be exported at any time to the XML file to your drive. In order to do so:

 

  1. Log in as a user with the Jira Administrators global permission.
    Choose   > Issues. Select Workflows > Condition Templates to open the Condition Templates page.
    (info) Tip: Use a Keyboard shortcutg + g + start typing condition templates
  2. Select the template you want to export and click Edit in the Operations section
  3. As soon as you choose the Export button, your template will be downloaded.

Inversing a condition result

Templates allow you to "inverse" a condition result. As a result, any failed condition is treated as passed and the other way round. This option is particularly useful when you look for a way to run such "except-type" conditions as "Everybody except issue reporter can execute a transition".

To inverse, a condition result add the condition to a template and then click the  inversion button located in the action bar.

The inversion indicator is displayed next to the condition's name. You can easily find all inversed conditions when editing a template.

When a condition is inversed you can see it as shown below: