Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

A workflow condition that hides/shows a transition based on the result

of 

of a Jira expression

The transition to which the condition is added will be available only if the Jira expression returns true. This can be used to test or compare issue fields, to test linked issues, to check for open Sprints, etc.

To add the 'Build-your-own (scripted) Condition'

When you add this condition to a transition

:
  • Click Edit for the workflow that has the transition you wish to configure the condition on.

  • In the Workflow Designer, select the transition.

  • Click on Conditions in the properties panel.

  • Click on Add condition.

  • Select 

    , the extension checks the result of a logical test, comparing a field value to either another field value or to a set value. The logical test can be a Jira expression entered manually, or you can build an expression using the No Code option (see below). If the expression returns true, the transition will be available to the user; if it returns false or a non-Boolean value, the transition will be hidden.

    Include Page
    [Includes] Add Condition
    [Includes] Add Condition

    Configure the condition

    1. Follow the steps above to add a condition to a transition.

    2. From the list of validators, select Build-your-own (scripted) Condition (JMWE app).

    3. The Build-your-own (scripted)

     Condition from the list of conditions.
  • Click on Add to add the condition on the transition.

  • Input a Jira expression in the Jira expression field.

  • For information on how to write a 'Jira expression' see How to insert information using Jira expressions.

  • Click on Add to add the condition to the transition.

  • Common mistakes while using this condition:

    Filter by label (Content by label)
    showLabelsfalse
    showSpacefalse
    cqllabel = "jira-expression"

    Other related articles

    Image Removed

    When you add this condition to a transition, the add-on checks the result of the Jira expression. If the expression returns true, the transition will be available to the user, and if it returns false or a non-boolean value, the transition will be hidden.

    Use case

    A typical use of this workflow condition is to hide the transition when a field of the issue has a specific value or the current user belongs to a specific group.

    Consider a use case where you want to show the “Approve” transition only when the current user is in the “Approvers” field. To configure this:

    1. Add the “Build-your-own (scripted) condition” to the “Approve” transition

    2. Input the following code under “Jira Expression”

      Code Block
      !! issue.customfield_10002 && issue.customfield_10002.some(it => it == user)

    Note it is suggested to use the “Issue Fields” tab of the Jira expression editor, select the field from the list and the Jira expressions editor help system shows examples on accessing and testing the field value.

    See https://appfire.atlassian.net/wiki/x/KYKtB for more uses cases for this condition.
    1. Conditionpage will open. Configure the condition as needed:

      1. Set the Description.

      2. For Choose type, select either No Code or Jira Expression as the method of creating the logical test. See below for details on each of the configurations.

    2. Click Add.

    Note

    Note that you will need to publish the workflow for the new Condition to take effect.

    The following configurations are available:

    • Description - Give the condition a description; this will be included in the list of conditions for the transition and in the Workflow Extensions administration page.

    • No Code (Figure 1, right) - These fields will only display when Choose type is set to No Code. Select this option to create the condition without the need to write a Jira expression. Set each of the following options:

      • Field - Select the field to be tested.

      • Operator - Select the logical operation to use in the test; for example, Equals, Does not equal, is empty, Less than, or Greater than (among others).

      • Value to compare type - Select against what value the test will be evaluated:

        • Field - Compare the condition field against the value(s) of another field.

        • Text - Compare the condition field against a set value.

      • Value to compare - Either select a field from the pulldown menu, or enter a set value.

    • Jira Expression (Figure 2, right) - The Jira expression editor will only display when Choose type is set to Jira Expression. Enter the Jira expression for the logical test for the condition. If this test evaluates to false, the condition will fail and the transition will not be available for selection.

    Tip

    Computed Expressions

    Computed Expression field showing the JavaScript result of configurationsImage Added

    If you use the No Code option to create your condition, the Computed Expression box (Figure 3, right) will populate with the equivalent Jira expression for your configurations. You will not be able to alter the script, but it is possible to test the script and to copy the script so it can be pasted elsewhere.

    Click Test ( testscript.pngImage Added ) to open a window where you can select an issue against which the script should be tested.

    Click Copy ( copyscript.pngImage Added ) to copy the script to your clipboard.

    You are viewing the documentation for Jira Cloud.

    Build-your-own Condition No Code Configuration ScreenImage AddedBuild-your-own Condition Jira Expression Configuration ScreenImage Added