JQL Query to get list of Child JIRAs
Asked by Pritam Rakshit:

Hello All,

I am using the below jql query to get list of Scenario and EPICs for a particular label.

However i also want to pull the Child EPICs under Scenario and Story's linked to the EPICs. Can you please advise how do i expand my query.

(type in (Scenario, Initiative) AND labels = "customer" OR type = Epic AND "parent link" is EMPTY AND labels = "customer" OR issueFunction in portfolioParentsOf("type = Epic and labels = 'customer'")) AND status not in (Rejected, Canceled, Cancelled)

I also tried below query

(issuetype in (Scenario, Concept) AND labels = "customer") OR (issuetype = Epic AND issueFunction in linkedIssuesOf("issuetype = Scenario AND labels = 'customer'", "is parent of"))

Regards,

Pritam Rakshit


Answers:
author: Prosper Agwegiokhe
body: Hi [@Pritam Rakshit](/t5/user/viewprofilepage/user-id/5536694),

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

The app 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 the query below to get your desired results:

issue in childrenOfIssuesInQuery("type in (Scenario, Initiative) and labels = 'customer'") or issue in parentsOfIssuesInQueryRecursive("") and labels = 'customer'

Please contact our [support](https://jqlsearchextensions.atlassian.net/servicedesk/customer/portal/2) if you have any other questions about this query.  
We'll be happy to help you!

Best regards.

comments: author: Pritam Rakshit
body: I used the below jql

issueFunction in portfolioChildrenOf("labels = 'customer'") AND issuetype = Epic)


author: Pritam Rakshit
body: In our JIRA version i don't have the option for childrenOfIssuesInQuery.


author: guismb
body: Hey [@Pritam Rakshit](/t5/user/viewprofilepage/user-id/5536694) , one quick question, your relationship seems to go above the 3 level on JIRA standard plan, are you using the Premium plan or a 3rd party plugin ?

By looking at your issuefunction I'm assuming you're using script runner.. In that case this may help, probably need to adapt to your relationship on issuetypes.

    issueFunction in subtasksOf("Additional JQL search here to look for the parent issues you want to define")

comments: author: Pritam Rakshit
body: Hi,

I am not sure about the plan, we use access provided from our organisation.

I tried your function however it didn't return the EPICs under the Scenario having labels customer

issueFunction in subtasksOf("issueType = Scenario AND labels = 'customer'")

I also tried to add it to the entire query however that also didn't work.

type in (Scenario, Initiative) AND labels = "customer" OR type = Epic AND "parent link" is EMPTY AND labels = "customer" OR issueFunction in portfolioParentsOf("type = Epic and labels = 'customer'") OR issueFunction in subtasksOf("issueType = Scenario AND labels = 'customer'") AND status not in (Rejected, Canceled, Cancelled)


author: guismb
body: I would recommend then first understanding which tools are you available to use, as I said, the standard JIRA plan does not go beyond 3 levels which mean you can only look for Epic, User Story and Subtask, this would also mean some functions wont work in the JQL like issueFunction (this is a function that ScriptRunner adds to your JIRA instance).


author: Pritam Rakshit
body: I used the below jql and it worked.

issueFunction in portfolioChildrenOf("labels = 'customer'") AND issuetype = Epic


Tags: data-center

jira-data-center

jql