JQL query to find child issues of Initiative

Traci Elswick April 11, 2017

Is there a single JQL query which can find all the child issues of a given Initiative? down through the hierarchy including Epics, Issues, etc?

10 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

8 votes
Answer accepted
Roi Fine
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2018

Hi Traci,

Getting all child issues of an initiative via JQL is possible since Portfolio 2.10, you can check the details here: https://confluence.atlassian.com/jiraportfolio/portfolio-for-jira-2-10-release-notes-940678731.html#PortfolioforJira2.10releasenotes-childissues

Cheers,

David.Oberst May 15, 2018

Is it possible to use JQL in the Confluence JIRA Issue/Filter macro to display a table of all the issues of a Portfolio Initiative?  The link above seems to be creating a query in Portfolio itself [ issuekey in childIssuesOf("INIT-001") ], but I can't seem to find equivalent JQL syntax that will work in the Confluence macro to retrieve the issues.

I can insert the initiative itself with the macro, and assuming all the issues also have the label "MyLabel", I can generate the table with 'labels = "MyLabel" '.  But I'd like to directly retrieve the initiative's issues.

This is cloud JIRA with Portfolio and Confluence on.

Like Alex Jacobs likes this
Mao Lee June 22, 2018

This sound like you can only query for child issues for one Initiative at a time.  Is this correct?  Is there a way you can put more than one Initative in this query issuekey in childIssuesOf("INIT-001")? So, let's say, I want to see all the Child Issues in INIT-100 and INIT-200, can I query for both of them at the same to show on the screen?  Hope this make sense.  Thanks.

Like # people like this
Tim H_
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.
August 24, 2018

@Mao Lee, childIssuesOf() only takes one argument, but you can do this:

(issuekey in childIssuesOf(INIT-100) OR issuekey in childIssuesOf(INIT-200))

Like # people like this
Andy Bayford June 5, 2019

This hasnt worked for me.  I could be doing it wrong.  I have no idea what Portfolio is.  What I want to be able to do is configure a board and put a fast filter in.  I want the query to return all the Storys from an Initiaive (and the associate epics)  I put 

issuekey in childIssuesOf("INIT-001") in the query box, yet it returns no storys when I click on the filter.   

Any help would be appreciated.

Roi Fine
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 2019

Hi Andy, 

 

To make this work you will need to have:

1. Portfolio for Jira Server installed (any version above 2.13)

2. Epics with Parent link assigned to the initiative you are looking for it's children 

3. Stories with Epic link assigned to the linked Epics above

For points 2,3 have a look at this previous post - https://community.atlassian.com/t5/Portfolio-for-Jira-questions/JIRA-Portfolio-epic-link-vs-parent-link/qaq-p/947705

 

I hope this helps,

 

Cheers,

Like # people like this
cathy May 28, 2020

When will there be support for childIssuesOf() taking in multiple issue keys, or filters as a parameter? I have a filter containing all of the initiatives in my Plan. I'd like a query to return all the children of all those initiatives

Like # people like this
Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 24, 2021
21 votes
Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 24, 2021

Hi everyone,

CC: @cathy @Abhi Singh 

In Jira Cloud you can currently find the children of initiative by specifying the issue key:

issuekey in portfolioChildIssuesOf(MYKEY-1)

You can specify multiple keys by duplicating the above query and connecting the queries with OR.

To get children of initiatives based on more advanced criteria you can install our professional indexing service:

After you install the app you can simply search:

issue in childrenOfIssuesInQuery("project='ACME' and type=Initiative")
issue in childrenOfIssuesInQuery("key in (MYKEY-1, MYKEY-2, MYKEY-3)")

You can also find children of initiatives and children of their children with the recursive function:

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

Make sure to check out the documentation.

I hope this helps!

Daniel

10 votes
Iain Brown July 23, 2020

After much trial and error I have been able to create a query that returns all items in the hierarchy using only the initiative id.  

This is with Jira cloud V 7.13 with Scriptrunner but NO Portfolio.  Jira cloud means some scriptrunner functions are not available.

The main difficultly here is to construct a triple nested issueFunction but eventually the right combination of ", \" and ' was found below.  In this example the initiative was XYZ-997 and the Epics have a 'is parent task of' relationship and stories are Epic links.  After the query there is  an explanation of the three sections required.  This has been checked on a single initiative with Epics, stories and subtasks.

(issueFunction in subtasksOf("(issueFunction in linkedIssuesOfAll(\"issueFunction in linkedIssuesOfAll('issuekey = XYZ-997','is parent task of')\"))  AND issuetype not in (Epic)")) OR ((issueFunction in linkedIssuesOfAll("issueFunction in linkedIssuesOfAll('issuekey = XYZ-997','is parent task of')")) AND issuetype not in (initiative)) OR issueFunction in linkedIssuesOf("issuekey = XYZ-997","is parent task of")

Epics :

issueFunction in linkedIssuesOf("issuekey = XYZ-997","is parent task of")   

This piece of the query returns all linked issues to the initiative XYZ-997.  In this case this returns a list of 5 Epics.

 Stories, bugs etc that are linked to the Epics :

((issueFunction in linkedIssuesOfAll("issueFunction in linkedIssuesOfAll('issuekey = XYZ-997','is parent task of')")) AND issuetype not in (initiative))

This nested issue function query takes the list of Epics query above and nests this into a further linkedIssuesOfAll to retrieve all linked issues.  Because the Initiative is also returned, an AND issuetype restriction is used to prevent the initiative appearing in the final results.  Due to the syntax for scriptrunner the quotation marks around the inner query are replaced with '.

Subtasks which are linked to the stories, bugs etc

(issueFunction in subtasksOf("(issueFunction in linkedIssuesOfAll(\"issueFunction in linkedIssuesOfAll('issuekey = XYZ-997','is parent task of')\"))  AND issuetype not in (Epic)"))

This triple nested issueFunction query takes the list of Stories etc, which in turn is derived from the list of Epics and returns all linked subtasks.

Due to the syntax for scriptrunner the escape quotation must be used.  

Iain Brown July 24, 2020

issuefunction in issuesInEpics("issueFunction in linkedIssuesOfAll('issuekey = XYZ-997','is parent task of')") could also be used to obtain stories, bugs etc that are linked to Epics.

6 votes
Chris March 11, 2021

I just did "Parent Link" = XXX-0000

This got me everything I need. Think is was using a script runner function in Jira CLoud

1 vote
Gavin
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.
July 8, 2021

So I'm seeing a lot of JQL here but none of them have given me the successful results of showing the children of a parent issue.  I don't scriptrunner but have Jira Premium (Portfolio) aka Advanced Roadmaps.

overview:

parent issue - MDC-27

children issue - MDC-76 & MDC-77

  • went to each
  • click on more link 
  • This is a child of
  • issue: MDC-27
  • in MDC-27
    • shows in Issue Links > is a parent of
      • MDC-76 & MDC-77

how I'm doing the queries

  • going to jira search > advanced > entering the jql there

 

Errors/Unsucessful:

  • issuekey in childIssuesOf(MDC-27) - No issues were found to match your search
  • childIssuesOf("MDC-27)") - Error in the JQL Query: Expecting operator but got '('. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 14)

How do I find all the issue that a parent has through a query?

Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 8, 2021

It's 

issuekey in portfolioChildIssuesOf(MDC-27)
Like # people like this
Abhi Singh July 28, 2021
Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 24, 2021
Like Abhi Singh likes this
1 vote
Ram Muthiah March 26, 2019

If you use cloud version, https://confluence.atlassian.com/jiraportfoliocloud/searching-for-portfolio-for-jira-custom-fields-in-jql-941619014.html would be useful. 

 

issuekey in childIssuesOf() does not work in cloud version.

Michael Adams February 25, 2020

Is this still a limitation of the cloud version? 

Like # people like this
Eva (they/she) June 11, 2020

Seems to be, yes -- here we are in June 2020 and Cloud doesn't recognize childIssuesOf() as a JQL function. 

Like # people like this
Maksim_Feshchanka July 6, 2020

For the Cloud version try this one:

  • issueIsAChildOf in (ABC-123, XYZ-987)
Like # people like this
Iain Brown July 24, 2020

Parent Link and Childissues of require Jira Portfolio ( which I don't have access to).

Like Tom Hawkins likes this
0 votes
fmak August 6, 2021

parent = MDC-27

0 votes
Abhi Singh June 10, 2021

We have Jira Premium (Portfolio) for Cloud enabled and are unable to use this function. Do I have to enable it somehow first?

issuekey in childIssuesOf(ABC-123) order by created DESC

Error: Unable to find JQL function 'childIssuesOf(ABC-123)'.

Also, it's interesting that all the answers above have somewhat different syntax for this same child issues function.

Tom Hawkins June 10, 2021

Hello @Abhi Singh  In our Jira v8.15.0 Server instance the JQL for your example would be  issuekey in (childIssuesOf("PRO-XXX")) so not identical to your post, but given we're not running Portfolio, results may differ. 

Like Abhi Singh likes this
0 votes
Tom Hawkins May 28, 2021

This used to be a massive problem for me not using ScriptRunner or Portfolio, but I have relatively recently discovered that key in (childIssuesOf("PRO-XXX")) works, not sure when it was introduced but it's exactly what I wanted, if PRO-XXX is an Epic then it gives stories etc. AND subtasks of those stories, in the way that parent in never did.

0 votes
David Jones March 4, 2021

I was able to do it with JQL that looked like this 

 

issue = ipe-996 AND project = "IPE Projects" OR issueLink = ipe-996 AND project = "IPE Projects" 

 

That gave me a view that had the parent issues and associated stories only. 

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question