---
title: "JQL use cases"
canonical: "https://support.appfire.com/space/JSU/12681740/JQL%20use%20cases"
format: markdown
---
> Macro (aura-html)

> ℹ️ This content is for JSU for Jira Server/Data Center. If you are using JSU on Jira Cloud, see our JSU Cloud [documentation](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518307).

<span style="color: #333333">JSU includes a </span><span style="color: #333333">[JQL Condition](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12681775)</span><span style="color: #333333"> and </span><span style="color: #333333">[JQL Precondition](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682075)</span><span style="color: #333333">. We've also integrated JQL in many of our </span><span style="color: #333333">[workflow post functions](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682779)</span><span style="color: #333333">, allowing Jira administrators to set wider parameters that can be fully customized. Below, you will find a few examples of how flexible and powerful JQL can be when used with JSU.</span>

<span style="color: #333333">Refer to the </span><span style="color: #333333">[JQL Reference](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682093)</span><span style="color: #333333"> for details on how to use JQL with JSU.</span>

## JQL Conditions

##### **Is Issue in current sprint?**

```
Sprint in openSprints() AND key = {issue.key}
```

##### **In the IT department only the approver can perform the transition**

```
approver = currentUser() OR component != "IT department"
```

*Or in other words: The condition is valid if the current user is the user in the approver field OR anything not belonging to the IT department.* 

##### **All other sibilings must have status**

```
parent = {issue.parent} AND key != {issue.key} AND status in (Resolved, Closed)
```

With `parent = {issue.parent}` we find all siblings of the current sub-task. However we want to exclude the current sub-tasks, so we add `key != {issue.key}`.

## JQL Precondition

With [workflow preconditions](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682104) for post functions, you can limit in which cases a JSU post function is performed. 

##### **Check if Testing Sub-Task already exists**

```
parent = {issue.key} AND issuetype = "Testing Sub-Task" 
```

With `parent = {issue.key}` we retrieve all sub-tasks of the current issue in transition. We then refine this to a specific sub-task type with `AND issuetype = "Testing Sub-Task"`.

For example, you might create the "Testing Sub-Task" with the [Create a Linked Issue](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682165) post function, but only if it doesn’t already exist:

![Workflow rule summary displaying the Post Function tab in Jira.](media://787f6cb0-4f1e-4c39-bbf9-e6a3f66415c5)

## JQL in post functions

In several JSU post functions, you can specify a JQL query to retrieve the issues that will be modified by the post function. See also [Related Issues](https://appfire.atlassian.net/wiki/spaces/JSU/pages/12682322).

### Update description of particular sibling issues

*Transition: Resolve in "Testing Sub-Task" Workflow* 

![Example of a JQL query used to define issue relation in the post function configuration.](media://54cbff62-7940-42e8-8e84-9e5865baad6e)

### Copy fields from template issue

Let's say we have an issue *XY-23*, which we are using as a 'template'. The issue is hidden in a project that is viewable only to Jira admins and has pre-configured values on several fields.

![Example of a JQL query for issue key in the post function configuration page.](media://6811431b-14c5-4c51-8467-a9583a8ba0be)

### Change status of critical issues in epic

If there are critical and blocker issues in an epic still in the open state, change it to [in progress] status.

![Example of a JQL query to define issues that have the blocker or critical priority assigned.](media://49398fad-5b37-4dce-a833-7c3be07bfa54)