I want to retrieve list of ticket id(Both Parent and Child) based on Custom field value in Parent.

Pramod_Kumar_Ojha December 16, 2024

Hi Atlassian team,

I want to retrieve list of ticket id(Both Parent and Child) using JQL query based on Custom field value present in Parent ticket.

Means i have a parent ticket called 'Request'. And in this ticket i have a subtask called 'Instance'.

In Parent ticket i have a custom field 'Customer / Organization' but this is not present in subtask.

I have executed below JQL query and wanted the list which contains both Parent and subtask(child) tickets. But i am getting only Parent tickets.

 

project = "VPC-Intake Cap Demand Mgmt" and resolution is not EMPTY AND type in(Request,Instance) and "Customer / Organization" ~ "ABC"

Please note Request is parent and Instance is Subtask(child).

Please suggest the correct JQL query.
Thanks!

3 answers

0 votes
Prosper Agwegiokhe December 16, 2024

Hi @Pramod_Kumar_Ojha

Welcome to the Atlassian Community!

My name is Prosper, a support engineer at Appfire, and I’m here to help.

If you are open a plugging suggestion, I recommend trying our App JQL Search Extension for Jira.

You can use this query:

issue in childrenOfIssuesInQuery("labels = gen") or issue in parentsOfIssuesInQuery("") and labels = gen


This query will return both parents and child issues where the parent issue has the label "gen", You can substitute this label for the custom field in question for your use case.

For more details about these queries, feel free to refer to our documentation, and don't hesitate to reach out to our support team if you have any further questions.

We’d be happy to assist you!

Best regards,
Prosper.

0 votes
Dan -minware-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 16, 2024

Disclaimer, marketplace partner!

@Pramod_Kumar_Ojha minware can help with this if you are open to working with a 3rd party. JQL has some funky limitations and we have a ton of automated workarounds to help make your reporting easier - there is a free trial available if you want to check it out.

Pramod_Kumar_Ojha December 16, 2024

 Hi  @Dan -minware- 
Sorry, I cannot use any third party app.

Like Dan -minware- likes this
0 votes
Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 16, 2024

Hi @Pramod_Kumar_Ojha

Unfortunately, this is trickier than one might think; as a hierarchical query, it would really require some kind of "join" or "subquery", which isn't available in plain Jira/JQL.

A few directions forward:

  • If it's a one-off thing, you could first query the relevant parents, and then use the keys of these parents in a second query, in a "parent in (KEY-1, KEY-2, ...)" clause.

If you want to run your search dynamically, without manually "stitching" two queries together, you'll need extra tooling:

  • You might be able to use Jira Automation to "propagate" parent information down to the children, and then use the respective field(s) on the children to include them into your filter. Obviously, this will add a fair bit of complexity to your system.
  • There's different apps from the Atlassian Marketplace that can help with that. First, there's a number of apps that extend JQL by additional functions, including hierarchy-related functions. I've used JQL Search Extensions a few times and it works well.
  • Alternatively, you could try one of the more hierarchy-focused apps from the Marketplace. These apps typically have their own ways of figuring out parent/child relationships between issues, and provide more powerful ways of searching through issue hierarchies. I myself work on such an app, in which your use case would be easy to solve - I'll provide more details below.

Hope this helps,

Best,

Hannes

Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 16, 2024

... and just to expand on the last point: This is how this would look in the app that my team and I are working on, JXL for Jira. Put simply, you'd create a sheet with all issues that are potentially relevant to you, model your issue hierarchy (if you're using the default hierarchy, that's just one click), and then use JXL filtering capabilities to narrow down to the issues that you care about:

sub-tasks-by-parent-labels.gif

(I'm using labels here, but it would work the same with any other field(s).)

Once you have your list of issues, you can work on these directly in JXL (much like you'd do in e.g. Excel or Google Sheets), trigger various operations in Jira, or export them for further processing.

Any questions just let me know!

Suggest an answer

Log in or Sign up to answer