How to create a JQL Adv Query that can function similar to SQL Inner Join?

starryeyes
Contributor
August 17, 2020

I am trying to create a filter to find bugs that are going into a release. Previously, the fixversion was required for every bug ticket. Now, it is no longer a required since all bugs  are link to an epic. All epics are tag to a release. 

Now I am trying to create a filter to capture

(1) all bugs that are tag to "Release A" and;

(2) all bugs that are not tag to release, but has an epic tag to  "Release A"

I tried to create two different filters but its not returning the right values

 

Filter 1: (issuetype = bug and fixversion ="######") 

Filter 2: (issuetype = bug and "epic link" is empty) and ("Epic Link" is not empty and fixversion = "####")

2 answers

0 votes
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2020

Hi @starryeyes 

Native JQL does not allow for sub-queries within a main query. So you can refer to one single Epic Link - but you can't search for a set of Epics based on field values.

As @Andrew Whitley mentions, you'll need an app for this with more advanced JQL functions - such as Scriptrunner 

This will allow for queries such as this:

fixVersion = "Release A" AND issuetype = Bug OR issueFunction in issuesInEpics("fixVersion = 'Release A'") AND issuetype = Bug

^ You can see here via issueFunction in IssuesInEpics we're searching for issues which are in any Epic which has that fixVersion - which is the sub-query required.

-----------------------

An alternative would be to populate the fixVersion on each Bug.

This doesn't have to be done manually - you could use an Automation Rule to trigger that if an Epic Link is added to a bug, or the Epic's fixVersion is modified, the fixVersion filters down to all child bugs?

Then you could use a base JQL query for this :). See more on Automation via these resources.

-----------------------

Let us know if the alternative sounds of interest and if you'd like help setting up a rule! As part of this, let us know if you're using Next-Gen or Classic :)

Ste

0 votes
Andrew Whitley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 17, 2020

Since the Bug tickets don't necessarily have the version anymore you have to rely on the Epic that has the version. So you need to find all of the Epics in the Version and then from there find all of the bugs associated to them. Unfortunately there is not a way to do this by default, but you may be lucky and have an app installed that has this functionality like Scriptrunner. In a jql search type in "issuefunction in" without the quotes and if it populates with a lot of options you have it. Here is the documentation if you do:
https://scriptrunner.adaptavist.com/5.6.8/jira/jql-functions.html

If not, you are most likely out of luck as there really aren't many alternatives.

Suggest an answer

Log in or Sign up to answer