Show parent Issue's information when querying sub-tasks

I want to use JQL to generate some report in the Issue Navigator page.

The requirement is I want to query from sub-tasks, but for each record of the sub-task, I aslo want to display some other information of the associated issue (parent).

e.g. 1. There are issues A, B, C;

2. Issue A includes sub-task a, b, c; Issue B includes sub-task d, e, f; Issue C includes g, h, i

3. given some conditions, a, b, c, d, e are the expected results show on the page, besides the information of sub-task, I also want to add information of its parent issue's (like, title, summary, etc)

Anyone knows how can I write the JQL which can satisfy my requirements?

I know a plugin called JQL Tricks plugin, but seems it can't do what i want.


2 answers

1 vote

First, you are confusing JQL and SQL slightly. We're all used to having SQL where you say "give me a list of data from the records matching my question", but JQL does NOT do that.

JQL only returns a list of issues. It doesn't display them or allow you to work with the data on the issues, it just gets a pointer to the issues to work with. There is a slight quirk of display in that it lets you define a sort order, but that's the only display thing it does. It also generates and holds some statistics (number of issues returned etc) to make reporting more simple.

It's then up to your display to work with that list of issues to get your data out in a useful format. The issue navigator for example, has a list of fields and it goes and looks up the data for each of the fields for the list it's given by JQL. Excel output does much the same. Gadgets like "filter statistics" take the list of fields and give you information about them without reading much data from the list of issues. And so on.

What I'm getting at here is that JQL is not the way to do this, and you're looking in the wrong place. JQL will give you the list of issues to work with, and the JQL tricks plugin can help you with more clever queries.

But for your display, you can't do anything like that because JQL is NOT what displays the information. The issue navigator is built as a simple grid display, and can't do the customised displays you want.

So, the answer is actually "Yes, you can write JQL to satisfy your requirements, but you're going to need to write code to display the results in the way you want".

JQL itself is not enough. JQL is only a query language that always select issues. It is like an SQL query that starts

select issue from jira where

and it could not be changed.

The issue navigator displays the result set of issues. It displays ANY field of the issue as it is configured. If you need any information of its parent issue's (like, title, summary, etc) then you need to develop and configure one or more customfields for this calculated values. The starting point is CalculatedCFType that can be extended by your plugin.

The easiest way to do it let look at the groovy runner plugin's scripted field with a lot of working examples.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,061 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you