Search child tickets based on parent condition
Asked by tpedriel:

Hello I want to create a board that brings tickets based on the parent condition: Epic label = PMO.

I've tried the following but is not working:

project = PMO or ISSUE IN issuesInEpics("labels = PMO")

Error: Unable to find JQL function 'issuesInEpics(labels = PMO)'.

Can you help me please? Thank you


Answers:
author: Trudy Claspill
body: Hello [@tpedriel](/t5/user/viewprofilepage/user-id/5055886)

If you are using only native JQL functionality in Jira there is not method to select children of Epics based on a filter to select the Epics. That would require a third party app.

There are several that extend JQL capabilities

[https://marketplace.atlassian.com/search?product=jira\&query=jql](https://marketplace.atlassian.com/search?product=jira&query=jql)

Some provide functions that would provide the functionality you want.

Are you using any of those apps currently, or are you willing to consider getting an app to satisfy your need?


author: Charlotte Santos -Appfire-
body: **Hi [@tpedriel](/t5/user/viewprofilepage/user-id/5055886)**

I'm Charlotte, a support engineer at Appfire and I'm here to help you.

Unfortunately, natively, you'll not be able to do it dynamically.

In the app where my team works, [JQL Search Extensions for Jira](https://marketplace.atlassian.com/apps/1214791/jql-search-extensions-for-jira-reports?hosting=cloud&tab=overview&utm_source=atlassiancommunity&utm_medium=listinglink&utm_campaign=mauricio), you can use this query to get all issues whose epic parent has a specific label:

```
issue in childrenOfEpicsInQuery("labels = PMO")
```

Please contact our [support](https://appfire.atlassian.net/servicedesk/customer/portal/11) if you have any other questions about this query.

We'll be happy to help you!


author: Hannes Obweger - JXL for Jira
body: Hi [@tpedriel](/t5/user/viewprofilepage/user-id/5055886),

just to expand on Trudy's answer, this is unfortunately 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 epics, and then use the keys of these epics 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](https://www.atlassian.com/software/jira/features/automation) to propagate epic information down to the epic's 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](https://marketplace.atlassian.com/) that can help with that. As already mentioned, there's a number of apps that [extend JQL](https://marketplace.atlassian.com/search?query=jql) by additional functions, including hierarchy-related functions. Scriptrunner and JQL Search Extensions are popular, but there are others as well.
* Alternatively, you could try one of the more [hierarchy-focused](https://marketplace.atlassian.com/search?query=hierarchy) 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 query would be easy to solve - I'll provide more details below. I should add that these apps typically come with their own views, which may or may not work for your use case.

Hope this helps,

Best,

Hannes

comments: author: Hannes Obweger - JXL for Jira
body: 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](https://marketplace.atlassian.com/apps/1224710?hosting=cloud&tab=overview&utm_source=atlassian-community&utm_medium=referral&utm_content=2648056). Put simply, you'd create a sheet with all issues that are potentially relevant to you, enable the default issue hierarchy (that's just one click), and then use JXL filtering capabilities to narrow down to the issues that you care about:

![epics-by-label.gif](https://community.atlassian.com/t5/image/serverpage/image-id/269305iE8CCBE711F02A567/image-size/large?v=v2&px=999 "epics-by-label.gif")

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

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!