JQL Query Matches Condition
Use the JQL Query Matches Condition to control if an issue can be transitioned based on if a JQL query would return the current issue.
For example:
- If you want the transition to be allowed when the current issue is using the Task issue type, you would use the JQL query:
issuetype = "Task"
- If you want the transition to be allowed when the current issue has a Priority of Medium or higher, you would use the JQL query:
priority >= Medium
Use this condition
You can add this condition to any transition except the Create transition.
- Go to Administration > Issues > Workflows.
- Select Edit on the workflow you want to add a condition to.
- Select the transition to which you wish to add a condition.
- Under Options, select Conditions.
- On the Transition page, select Add condition.
Select JQL query matches condition.
- Optional: Enter a note that describes the condition.
Enter your JQL Query.
- Optional: Enter a preview issue key and select Preview. See the example below for more details.
Select Update.
Select Publish and choose if you want to save a backup copy of the workflow.
Testing your JQL
You can use the Preview feature within the workflow condition to test your JQL query against a specific issue.
- Edit or create a new JQL query matches condition.
- Enter your JQL Query.
- Enter the key for an issue you want to test with into Preview Issue Key.
- Click Preview.
This conditions JQL is efficient; for example if the query you enter would typically return millions of issues, it will be modified to something like the following:
groovy{issue = 15130} AND {issuetype = "Task"}