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.

  1. Go to Administration > Issues > Workflows.
  2. Select Edit on the workflow you want to add a condition to. 
  3. Select the transition to which you wish to add a condition.
  4. Under Options, select Conditions.

  5. On the Transition page, select Add condition.
  6. Select JQL query matches condition [ScriptRunner]

  7. Optional: Enter a note that describes the condition.
  8. Enter your JQL Query.

  9. Optional: Enter a preview issue key and select Preview. See the example below for more details.
  10. Select Update.

  11. 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.

  1. Edit or create a new JQL query matches condition.
  2. Enter your JQL Query.
  3. Enter the key for an issue you want to test with into Preview Issue Key.
  4. 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"}



Related content

On this page