Std JQL how to get parents and children of my query for stories?
Asked by rachel rutti:

The query works to say project in ("xxx") and issuetype in ("Story") and status in ("UAT", "FUT")

Great,

Now how do I say give me those user stories and the parents and children of those (which would be epics and subtasks) ?

and just for grins, how would I say give me the grandparent also (program epic)

Thanks much!


Answers:
author: Trudy Claspill
body: Hello [@rachel rutti](/t5/user/viewprofilepage/user-id/3281338)

Your post tags don't say what hosting type you are using but I see in your other posts you have tags for Jira Cloud. Are you using Jira Cloud?

I also note that you have not told us the Plan to which you have subscribed; Free, Standard, Premium, or Enterprise. But you did mention parents (Programs) of Epics. Is that an indication that you are on a Premium or Enterprise plan, and are using the Advanced Roadmaps Plan feature with an Issue Type Hierarchy that has been extended to include levels above Epics?

Additionally do you have any third party apps that extend the JQL capabilities of your environment, such as ScriptRunner, JQL Tricks, or others?

With only native Jira JQL functionality there are limitations on what you can achieve.

You can get all the subtasks under a specific issue using a filter like this:

parent={*issue key}* and issuetype in subtaskIssueTypes()

To get the subtasks of multiple issues you could use:

parent in (*{comma separated list of issue keys}*) and issuetype in subtaskIssueTypes()

However, in both cases you must explicitly list the issues for which you want the subtasks. Native Jira JQL functionality doesn't support inserting a subquery into the filter to dynamically select the parent issues and then get all their subtasks.

You can learn more about native JQL functions here:

<https://support.atlassian.com/jira-software-cloud/docs/jql-functions/>

There is no function for getting a list of the direct parent issues for a list of child issues.

If you are using the Premium or Enterprise subscription plans they you will also have access to these functions:

<https://support.atlassian.com/jira-software-cloud/docs/search-for-advanced-roadmaps-custom-fields-in-jql/>

These include functions that will give you all the child issues through multiple levels for a specified issue:

<https://support.atlassian.com/jira-software-cloud/docs/search-for-advanced-roadmaps-custom-fields-in-jql/#Child-issues>

Again, unfortunately, there is still no native function to get the parent, grandparent, etc. above a given issue. And these additional functions also do not support including a subquery to generate a dynamic list of the issues for which you want the children.

With some third party apps that extend JQL capabilities it is possible to insert subqueries so that you could create a dynamic list of issues for which you want to know the child issues, or the parent Epics. With the ScriptRunner Enhanced Search app specifically you can do that, and also get the parent/grandparent/etc. hierarchy for issues selected by a subquery.

<https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions#subtask-functions>

That assumes you are using the extended Issue Types Hierarchy to create the parent/child relationships above Epics. If you are doing that through generic issue linking instead, then you would need to look at the Issue Link functions:

<https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions#issue-link-functions>

comments: author: rachel rutti
body: Okay, thank you sooo much... I re-read this several times, so if it's okay, I will get started and ask additional questions. I have asked several times of our cloud/hosting and not received an answer yet. Can I tell by looking somewhere in Jira?

The application is that I am using a dashboard, filter results, and simply want all the user stories in UAT and FUT status (I could make an explicit list if I have to) and then, in that filter result, I also want to see the Epics and hopefully Program Epic, as well as the subtasks under the stories, and list them in the correct hierarchical order.

So far, have not received an answer on extended capabilities. Any place I can see what we may have available? Like the old marketplace.

Can you show me how I would combine the parent and subtask statements (using explicit list) so my filter result is program epic, epic, story, subtasks of the explicit list?

So grateful!


author: Trudy Claspill
body: > I have asked several times of our cloud/hosting and not received an answer yet. Can I tell by looking somewhere in Jira?

Click on the Help button (labeled with a question mark) near your avatar in the upper right corner and select About. What does it show you? If it shows you a version number like the following, then you are using Jira Server or Jira Data Center (self-hosted). If it doesn't then you are using Jira Cloud.

![Screenshot 2024-08-13 at 7.35.52?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/341531iF058CFA612F2225E/image-size/large?v=v2&px=999 "Screenshot 2024-08-13 at 7.35.52?AM.png")

If you are not an Administrator there is not a definitive way for you to find out what plugins are on your system.

If you can get at least the hosting information using the About option then we don't have to list out all the details for how to try to execute the queries for all types of systems.

Some additional helpful information you could provide:

Do you see a menu option named Plans? If you do, are you familiar with that functionality? Do you use it? Do you have plans that show a hierarchical structure for...?

```
Program Epic
|-- Epic
    |-- Story
        |-- subtask
```

Do you see a menu option labeled Apps? If so, what options are listed there?

Given that there is not a function to give you a list of parent issues, I can't provide you with a combination of statements that will give you what you want.

You would have to first look at all the Stories that you want to include and manually get the Epic issue keys from each one to create a list of those.

Then you would have to look at each of those Epics and manually get a list of the keys for their Program Epics.

Then to get those and the Stories and the Subtasks all as the result of one filter you would need to do this:

issue in (*comma separated list of Program Epic keys* ) OR  
issue in (*comma separated list of Epic keys* ) OR  
(issuetype=Story and status in (FUT, UAT) and project=XXX) OR  
(parent in (*comma separated list of Story issue keys* ) and issuetype in subtaskIssueTypes())  

The above is assuming that you don't have access to Advanced Roadmap Plans and/or you are not using the extended Issue Type Hierarchy to create the parent/child relationship between Program Epics and Epics.


author: rachel rutti
body: Yes, I am familiar with Plans and how they show the Hierarchy. I can do that and have made them. Was just using dashboard filter results gadget because the fields available in the Plan is very limited, like we can't have most recent comment, which is basically our latest status. (Asked Admins to add most recent comment to the Plan available fields and a couple others and they weren't able to)

Yes, we have program epics, and yes, after asking again today about extensions, was informed we may have script runner (woo hoo) which is a game changer (had asked before and no answer). He is finding out how we get access to scriptrunner or if it's something simple, let me know.

Yes, about Jira gives me a license number and version so it appears we are hosted not Cloud. thank you.

I may have some admin options given so I could view the workflow, so yes, I will look there about plug-ins, scriptrunner.

In the meantime will try your solutions above and another person answered with a solution.

Thanks a million!


author: Trudy Claspill
body: If you think you might have ScriptRunner you can test that out by trying a query like this:

    issueFunction in epicsOf("issuetype=Story and status in (FUT,UAT)")

"issueFunction" is a keyword provided by apps like ScriptRunner to tell Jira you want to access the specified custom JQL function (epicsOf). If you don't get a syntax error, then you have ScriptRunner or another JQL extender that includes the same function (epicsOf)

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/issue-links#epicsOf>

That specific function would get you all the Epics of the issues selected by the query in the parentheses. You may want to add criteria to that to limit the selected Story issues to specific projects.

You can find more information about ScriptRunner JQL functions for Jira DC here:

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions>

To get the parent Program Epics of Epics you would use the portfolioParentsOf() function

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/portfolio#portfolioparentsof>


author: rachel rutti
body: Thank you, I was trying that issuefunction previously and had syntax errors previously but wasn't sure of the syntax. let me try yours listed above and see what results I get. Does ScriptRunner access need to be explicitly given to users?

Again, super appreciate the direction.


author: rachel rutti
body: Okay, good news... issuefunction in epicsOf("issuetype=Story and status in (FUT,UAT)")

did not produce a syntax error, so it appears, as you suggest, then, we have an Extension or ScriptRunner. So, is there a way to tell which one so I can look at the correct link for syntax help?

One snag, but was able to figure it out, is we have a "custom name" for Story, that is, XXAgile Story with a space, so for anyone else that needs it, after multiple attempts, this is what worked:

issuefunction in epicsOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)")

Relieved. Thank you so much!

Now, however, short lived, this is what I really want the query to do:

1) The parents, which we got working :)

2) The children, (of those in FUT, UAT) which would be the Sub-Tasks

3) And the actual XXAgile Stories as well.

4) and if it's not too much trouble to list them in hierarchical order

(The Sub-Tasks need to be in the order they are listed in the User Story)

5) Then to make it be perfect, we would have in the query results, the Program Epic (above the epic) which would be the XXAgile Story's grandparent.

Whew... super excited as see the potential for this working! So grateful!

So in summary,

The query would get the user stories in FUT and UAT status and show me those, as well as the Subtasks under them, and the Epic and Program Epic above them.

:)


author: rachel rutti
body: issuefunction in epicsOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)") OR issueFunction in subtasksOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)")

This appears to be working. So I will carry on with the query, no need for help on that unless I run into a grandparent snag.

But, I would be interested in the syntax or link to show me how to order by rank or the syntax to show them in the "correct" hierarchical order .....and really need the subtasks in order listed in the story.

Program Epic

Epic

Story

Subtasks

Thank you!


author: rachel rutti
body: iissuefunction in epicsOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)") OR issueFunction in subtasksOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)") OR issuetype in ("XXAgile Story") and status in (FUT,UAT) OR issuefunction in portfolioParentsOf("issuetype= 'XXAgile Story' and status in (FUT,UAT)") order by rank

1 I don't think Order by Rank gives me what I want. Is there a better way to say order by hierarchical order? and the subtasks in order listed in story?

2. portfolioparentsOf does not pull in the program epics

and didn't see grandparent function or programepic function.


author: Trudy Claspill
body: Hello [@rachel rutti](/t5/user/viewprofilepage/user-id/3281338)

You've done a lot of good work on this since last time I checked in! Congratulations!
> So, is there a way to tell which one so I can look at the correct link for syntax help?

I am not aware of a conclusive way for a non-administrator to determine which plugins are installed. With regard to the JQL extending plugins I think one would need to look at the documentation for each one for functionality that is unique and see if that functionality can be used.

In the last query you posted to ensure proper processing of the ANDs and ORs I recommend that you surround this portion of the query with parentheses:

issuetype in ("XXAgile Story") and status in (FUT,UAT)

On to the questions in your last response:

1. Order By Rank orders issues by the listing you would see in an agile board, not based on their hierarchical relationship. There is no option to make a filter display the results in accordance with the hierarchical relationship of the issues. You could, however, use the results of the filter as the data source for an Advanced Roadmaps Plan. Through an AR Plan you could see the issue arranged hierarchically.

2. Referring to the documentation for portfolioParentsOf() function:

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/portfolio#portfolioparentsof>
> Like `portfolioChildrenOf`, `portfolioParentsof` does not cross the boundary from Story to Epic, this is due to conflicting feature functionality.

So you can't use references to the Stories in that functions subquery. For that function you need the subquery to return a list of Epics for which the parent Program Epics can be retrieved.

I don't know if nesting of the issueFunctions is supported, but if it is this is what you need.

issuefunction in portfolioParentsOf("issuefunction in epicsOf('issuetype= 'XXAgile Story' and status in (FUT,UAT)')")

I don't have anyplace where I can test that out. One of the tricks in there is that there are three layers of quotes, and I'm not exactly sure when they need to be single vs. double quotes. An alternative would be to save the epicsOf() query as its own filter with a saved filter name that does not include spaces; i.e. EpicsOfSubquery. Then you could code the portfolioParentsOf() function thus:

issuefunction in portfolioParentsOf("filter=EpicsOfSubquery")


author: rachel rutti
body: You've done a lot of good work on this since last time I checked in! Congratulations!

*Thank you appreciate*
> So, is there a way to tell which one so I can look at the correct link for syntax help?

I am not aware of a conclusive way for a non-administrator to determine which plugins are installed. With regard to the JQL extending plugins I think one would need to look at the documentation for each one for functionality that is unique and see if that functionality can be used.

*I actually have been given some administrator rights....*

*So, can i see the Add-Ons, Extensions on the Project Administration?*

In the last query you posted to ensure proper processing of the ANDs and ORs I recommend that you surround this portion of the query with parentheses:

issuetype in ("XXAgile Story") and status in (FUT,UAT)

*Okay, thanks, will look at that.*

On to the questions in your last response:

1. Order By Rank orders issues by the listing you would see in an agile board, not based on their hierarchical relationship. There is no option to make a filter display the results in accordance with the hierarchical relationship of the issues. You could, however, use the results of the filter as the data source for an Advanced Roadmaps Plan. Through an AR Plan you could see the issue arranged hierarchically.

*Okay, I have done this... made a query... and then made it the issue source of a Plan....*

*I thought years ago, I did queries and they ordered in hierarchical order....but perhaps not... it did however at one place, help you nest your JQL while creating it by indenting aspects of it. Must have been an Add-On...*

2. Referring to the documentation for portfolioParentsOf() function:

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/portfolio#portfolioparentsof>
> Like `portfolioChildrenOf`, `portfolioParentsof` does not cross the boundary from Story to Epic, this is due to conflicting feature functionality.

So you can't use references to the Stories in that functions subquery. For that function you need the subquery to return a list of Epics for which the parent Program Epics can be retrieved.

I don't know if nesting of the issueFunctions is supported, but if it is this is what you need.

issuefunction in portfolioParentsOf("issuefunction in epicsOf('issuetype= 'XXAgile Story' and status in (FUT,UAT)')")

*.....and then we would have the next layer of nesting to get the Sub-Tasks.*

I don't have anyplace where I can test that out. One of the tricks in there is that there are three layers of quotes, and I'm not exactly sure when they need to be single vs. double quotes. An alternative would be to save the epicsOf() query as its own filter with a saved filter name that does not include spaces; i.e. EpicsOfSubquery. Then you could code the portfolioParentsOf() function thus:

issuefunction in portfolioParentsOf("filter=EpicsOfSubquery")

*Oh... bravo, that would be so much simpler if you can use the name of the filter (I hadn't thought of that) rather than the whole filter itself*

*I will try and circle back.*

*I do understand about the single vs double quotes since it took a few attempts to realize the custom story name needed to be in single quotes.*

*But....then .... we have the problem of viewing them in their hierarchical order.*

*I do see Plans doing that very well.*

*Thank you so much, was anxious to get back here and hear your thoughts over the last day.*

*Appreciate!*


author: Trudy Claspill
body: > *I actually have been given some administrator rights....*
>
> *So, can i see the Add-Ons, Extensions on the Project Administration?*

You probably won't be able to identify JQL extending applications from the Project Settings screen. Some apps do add an entry to the Project Settings screen, but usually only if there is some Project-level configuration needed for them.

![Screenshot 2024-08-16 at 2.05.18?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/342286i2AA9B0CCFD684F98/image-size/large?v=v2&px=999 "Screenshot 2024-08-16 at 2.05.18?PM.png")

If you have Jira Administrator permissions you could see the information about installed plugins from the Manage Apps option.

![Screenshot 2024-08-16 at 2.02.35?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/342285iC5F0643212B41096/image-size/large?v=v2&px=999 "Screenshot 2024-08-16 at 2.02.35?PM.png")

I look forward to hearing how the suggestions work out for you!


author: rachel rutti
body: Yes, thank you, should be back in touch today or tomorrow... appreciate you!!


author: rachel rutti
body: I will answer that administrator later today or tomorrow, but yes, Plans seems to be the simplest solution, though i will work on the queries and your suggestion for parenthesis.

In the meantime, for the Plans, can we say

Give me all the Epics with this Label or this Component --

(we know this works in a query behind the Plan - Issue source) - Done.

But then, I want the Plan to display all the children - which I have working....

But I don't want to have to make sure that the correct Component is on the Epic, the User Stories and Multiple Sub-Tasks under each User Story. It is a lot of work to make sure a label is on each epic, story, subtask and when someone quickly makes a subtask we shouldn't have to update the label and component.

What Issue Source filter do I use to

-explicitly state the Epics I want, with specific labels or components,

-but also in the Plan, I want to see the children and grandchildren (stories and subtasks) regardless if they have the aforementioned labels or component?

:)

Thank you, can't wait to see this....


author: Trudy Claspill
body: Are you now asking about a different query to get different results? Or are you trying to add the criteria for Components and Labels in Epics to the existing query we've already discussed?


author: rachel rutti
body: I'm hoping I don't need to do the extensive nested query if I am using Advanced Roadmap - Plans. (because I haven't done it yet)

I was hoping in Advanced Roadmap - Plans, I could just say - here's the query for epics or program epics....

....And then select, in Plan, Program Epic to Subtask and then all the children and grandchildren will all appear in hierarchical order.

Yes, it's a different query mentioned using labels and components (rather than subtasks in FUT, UAT) but the question is still the same: I should be able to create a query, get the results, and then tell Jira and give me all the children and grandchildren, or the parents of that query.

If not, I'll need to scroll back and start of the double nested query.


author: Trudy Claspill
body: The Sources you designate for a Plan can be a combination of Projects, Boards, and/or Filters, but you still have to provide some definition for what you want to include.

If you want Epics with certain labels or components you need a query like this:

issuetype=Epic and (component in (x, y, z) or labels in (a, b, c))

If you want all the child issues of those same Epics then you need this query:

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/issue-links#issuesinepics>

issuefunction in issuesInEpics("issuetype=Epic and (component in (x, y, z) or labels in (a, b, c))")

Save that filter as childIssuesOfSelectedEpics.

To get all the subtasks of those child issues you need a third query.

<https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/issue-links#subtasksof>

issuefunction in subtasksOf("filter=childIssuesOfSelectedEpics")

Combine those with ORs to get all three sets of issues.

(issuetype=Epic and (component in (x, y, z) or labels in (a, b, c))) OR  
issuefunction in issuesInEpics("issuetype=Epic and (component in (x, y, z) or labels in (a, b, c))") OR  
issuefunction in subtasksOf("filter=childIssuesOfSelectedEpics")  


author: rachel rutti
body: Okay, thanks, sorry it took a while to get back, but I have to get this working and now ready to start again on getting the children.

Because the labels or components query/filter works at the Epic level but these criterial are not necessarily listed explicitly on the stories and subtasks.

Now I just need to combine the queries you mentioned into one or like you said, use multiple in a plan.

Again, thank you. Will try this and get back.


author: rachel rutti
body: Okay, slowly but surely... the syntax is coming. For anyone else watching, here is one that worked and thank you Trudy, very very much for writing it out so clearly and explicitly.

issuefunction in subtasksOf("Filter='Report Issue 1452 POC'")

where the filter pulls one user story and this expression above pulls it's subtasks.

Will send updates as they come.


author: rachel rutti
body: woo hoo! yay!

This isn't exactly perfectly what I want, but that is coming soon!! But this works! Thanks so much Trudy!

issuefunction in subtasksOf("Filter='Report Issue 1452 POC'") or (filter='Report Issue 1452 POC') or issuefunction in epicsOf("filter='Report Issue 1452 POC'")

It should be framed, a masterpiece, how happy I am.

I will hone it to be exactly what I want, and share, but this shows - we can do it.

This gives me

one Story I used for the proof of concept (1452) (using a simple query/filter)

and it first, gives me the subtasks under it

and then it gives me the epic above it.

next I will use this to formulate to query the epics I want , the stories underneath, and subtasks under those.....

wish us luck!


author: rachel rutti
body: Good News and a question

project = "XXX" and issuetype in ("User Story") and Component in ("X", "Y", "Z") and status in (UAT) or issuefunction in subtasksOf("filter='Stories in UAT'") or issuefunction in EpicsOf("filter='Stories in UAT'") order by summary asc

This seems to work. Thanks so much for your support.

However.....

One Epic does not show up for a Story in UAT.

Until I explicitly state it should appear like this.

project = "XXX" and issuetype in ("User Story") and Component in ("X", "Y", "Z") and status in (UAT) or issuefunction in subtasksOf("filter='Stories in UAT'") or issuefunction in EpicsOf("filter='Stories in UAT'") or issuekey in (ERP1-xxx) order by summary asc

The reason appears to be that the Story is a link in the Epic but it's not in the section that says "Issues in Epic"

So, if you go to the + mark of the section "Issues in Epic" it appears you can only Create an Issue in Epic there.

Is there any way to make this Story in UAT that is a child of the Epic appear in the "Issues in Epic" section?

It appears that is why it is not pulling the Epic in......

So does that mean if a story is created first, then linked to an Epic, it can never be an Issue in the Epic?

.....And thus the EpicsOf function does not work and pull in the Epic of the child story?

I'd like to hear the answer to those questions, and I can try to add another OR clause where it would state or give me the parents of the stories in UAT, if there is such a function (rather than Epicsof) However I'll need to use both, since the majority of stories are Issues in their Epic.

Can you move or somehow get a story to be an "Issues in Epic" without creating a new one?

Thanks a mil!


author: Trudy Claspill
body: Do I correctly understand that the Epic that is missing is ERP1-xxx?

And this Epic does not have in its "Issues in Epic" section an issue that is in UAT?

But it has a **linked** issue that is in UAT?

You are correct that would be the reason the Epic is not included.

If you look at the details of that **linked** issue, does it have any information in its Epic Link field to indicate it is a child of some other Epic?

If it does have information in the Epic Link field, then the answer is no, you can't make it also be a child of a second Epic. An issue can have only one parent Epic at a time.

If it does not have information in the Epic Link field, then you could set the Epic Link of that issue to ERP1-XXX. However, that may have other unintended consequences elsewhere that Epic/child relationships are used.

Is it common for issues to have a link to an Epic rather than be in the Issues in Epic section?


author: rachel rutti
body: More good news... the jira gods are looking down on us....

It appears to answer my own question... if you go into Plans and update the Parent in Plans, it then adds the story to "Issues in Epics" .

And now, the query above pulls in the parent Epic because it is now an Issue in the Epic.

Thanks to the Plans updating it as such.


author: rachel rutti
body: Hi, thanks for your answer, sorry, I didn't see it when I typed up that last reply. Typically yes, the stories are issues in the Epics, but if I created the story before the Epic and then linked it later (because someone else was going to create the epic, but we needed the story), there are probably several like that, but clearly that is not ideal. :)


author: rachel rutti
body: Is it true thought that you can only Create an Issue in Epic? You can't say, put this story already created in the Issues in Epic section?


author: rachel rutti
body: The Advanced Roadmap had the Story as an orphan, because apparently it does not look at the Parent and Children links (which was correct and no, it did not have two different Epic parents)

The Plan or Advanced Roadmap, appears to look at the Issues in Epic section.

I was able to choose the Parent in the Parent field and it updated Jira and put the Story in the "Issues in Epic" section.

So that is a good to know, workaround.


author: rachel rutti
body: Okay, the culmination of this communication is here. Before I go off for the weekend, for anyone else that needs this, and a quick question....

I believe this is working (have not fully vetted it) but it appears to give me:

* The Epics I want - now can replace it with any Epic query
* The Stories under the Epics
* The Subtasks under those Stories

Perhaps you can see if there are any additional parenthesis needed to make sure it works right....

project = "XYZ" and issuetype in (Epic) and Component in ("X", "Y", "Z") and labels in (A, B) and status not in (Done, Cancelled) or issueFunction in issuesInEpics("filter='Epics All Comps w Labels A \& B'") or issuefunction in subtasksOf("filter='Issuesin A \& B Epics'") order by summary


author: Trudy Claspill
body: What is your question?


author: rachel rutti
body: This query appears to work. I was just asking if there are any additional parenthesis that you would suggest to to make sure it works correctly?

project = "XYZ" and issuetype in (Epic) and Component in ("X", "Y", "Z") and labels in (A, B) and status not in (Done, Cancelled) or issueFunction in issuesInEpics("filter='Epics All Comps w Labels A \& B'") or issuefunction in subtasksOf("filter='Issuesin A \& B Epics'") order by summary


author: Trudy Claspill
body: You don't need additional parentheses if the query is working correctly as it is, as long as you don't rearrange the criteria.

What you currently have is, essentially, "give me all the issues that match X or Y or Z", with X being everything before the first "OR", Y being the issuesInEpics, and Z being the subtasksOf.

As long as X is a set of criteria joined by ANDs, and Y and Z are just one criteria each, you won't need additional parentheses.

If our responses have helped you achieve your requirement, please consider clicking on the Accept Answer button abouve the relevant response threads so that your Question will be marked as Solved. This helps other users searching the community find posts that have validated solutions.


author: rachel rutti
body: Okay, thanks, I'll need to re-read what you wrote. Thank you.


author: Charlotte Santos -Appfire-
body: **Hi [@rachel rutti](/t5/user/viewprofilepage/user-id/3281338)**

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 will find functions that can show you all the issues within a hierarchy:

For example, you can use the query below to finds all parents of epics in project ACME, and parents of parents, and so on:

```
issue in parentsOfIssuesInQueryRecursive("project='ACME' and type=Epic")
```

You can also get the children recursively as well, for example:

```
issue in childrenOfIssuesInQueryRecursive("project='ACME' and type=Initiative")
```

This query finds all epics, stories, and subtasks in initiatives in project ACME.

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! ?

comments: author: rachel rutti
body: Hi, thank you. I am trying to figure out if I have access to ScriptRunner. Admin thought we had it but wasn't sure how to access it or request access. Creating an internal ticket and also trying some specific syntax to see if it works. Thank you, will be back in touch.


author: Danut M _StonikByte_
body: Hi [@rachel rutti](/t5/user/viewprofilepage/user-id/3281338),

Try something like this:

*parentEpic IN (EPIC-1, EPIC-2)* - this returns all the issues (epic, stories, sub-tasks) under epics EPIC-1 and EPIC-2.

Hope this helps.

Danut.

comments: author: rachel rutti
body: Oh great, thank you so much I will try this now.


author: rachel rutti
body: Getting ready to do this now. Can that parenthesis (Epic-1, EPIC-2) by chance be a query? instead of an explicit list? ....wishful thinking....


author: rachel rutti
body: Also, then, I suppose, could we do the same thing for Program Epic? And then see all the children below that? Would that look like parentProgramEpic IN (ProgramEpic-1, ProgramEpic-2) ?

Thanks!


author: Trudy Claspill
body: Hello [@rachel rutti](/t5/user/viewprofilepage/user-id/3281338)

The parentEpic() function is not available in Jira Data Center JQL. It is available only in Jira Cloud JQL.

But, to answer your other questions:

No, it cannot take a filter as input.

No, you could not use the same function to get parent Program Epics of Epics. And there is not an option to use the same function for other issues types just by changing the function name.

For information on the **native**JQL available in Jira Data Center you can refer to this documentation.

<https://confluence.atlassian.com/jirasoftwareserver/advanced-searching-939938733.html>

Note that link goes to the documentation for Jira DC 9.17. If you are using a different version then you need to select that version in the upper right corner to get the documentation related to your version.


author: rachel rutti
body: Unfortunately either ParentEpic does not exist in our hosted environment or I do not have access to it. I do have Parent and parentlink. Parent link just gives me what is below my explicit list of epics. I need the actual epic itself and then the subtasks under the stories.

Thank you tho!


Tags: children

jira-unknown-hosting-type

jql

parents

standard

subquery

unknown-hosting-type