---
title: "How to use JQL to create a validator"
canonical: "https://support.appfire.com/space/SUPPORT/89138353/How%20to%20use%20JQL%20to%20create%20a%20validator"
format: markdown
---
> Macro (div)
> 
> ### On this page
> 
> > Macro (toc)

# Summary

If you need to validate a transition based on the existence or non-existence of one or more issues determined from a JQL query, then read on! It is very simple to do with a [Conditioned validator - 3.x](https://appfire.atlassian.net/wiki/spaces/CW/pages/69304984).

# Steps

> Macro (table-plus)
> 
> | **Step** | **Discussion** | **Examples** |
> | --- | --- | --- |
> | Create a JQL query that will determine if the transition can proceed or not. | - Test the JQL in the Issue Navigator first. | - No unresolved subtasks: parent = XXX-1 and resolution is empty |
> | Add a [Conditioned validator](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=support&title=Conditioned%20validator&linkCreation=true&fromPageId=89138353) to the appropriate workflow transition | - Assumes you have installed the [Update on Transition for Jira](https://appfire.atlassian.net/wiki/spaces/CW) add-on |  |
> | Put the JQL query in the JQL Query field | - It is likely you will need to use one or more [substitution variables](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=support&title=Substitution%20variables&linkCreation=true&fromPageId=89138353) like **%original_key%** in place of a specific values you may have used while testing | - parent = **%original_key%** and resolution is empty |
> | Condition by how many issues are found by the query | - **%jql_result_count% **is the more [substitution variable](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=support&title=Substitution%20variables&linkCreation=true&fromPageId=89138353) that says how many issues were found
> - Put that value in the **Condition 1** **Value** field
> - Put **0** in the **Condition 1 Regex** field
> - Likely user cases are:
>   - Proceed with the transition if there are 0 issues found - do **not** select the **Negative** checkbox
>   - Proceed with the transition only if there was at least 1 issue found - select the **Negative** checkbox | - All subtasks must be resolved<br>```
> Condtion 1:
>    Value: %jql_result_count%
>    Regex: 0
> ``` |
> | Add a user friendly message that will show if the validator fails | - Add appropriate text to the **Message** field and optionally use [substitution variables](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=support&title=Substitution%20variables&linkCreation=true&fromPageId=89138353). | ```
> Message: All subtasks must be resolved before you can proceed. The following subtasks are not resolved: %jql_result_list%.
> ``` |
> | Save the post function |  |  |
> | Run a test scenario | - Use [How to get problem determination information](https://appfire.atlassian.net/wiki/display/CW/How+to+get+problem+determination+information) to debug your scenario if necessary.
> - JQL errors will be logged in the JIRA application log. Note: This is the most common cause for problems.
> - Remember, the JQL query runs under the user's permission unless you are using **Acting user** support. |  |

# Screenshot

![image](media://5f735466-c0f0-4943-b58c-146349726098)