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
You can add this condition to any transition except the Create transition.
Select the JQL Query Matches Condition [ScriptRunner] condition.
For details on how to navigate to ScriptRunner workflow functions, see Navigating to Workflow Functions.
- Enter a description of the condition in Note.
Enter your JQL Query.
Click Update.
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 reasonably efficient because even if the query you enter would return millions of issues, it will be modified to something like the below:
groovy{issue = 15130} AND {issuetype = "Task"}