JQL for a parent and all child tickets

Derek Sekuler
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 16, 2024

Hi. I have been playing around with and searching for a JQL query that will return a parent issue and all children. 

I've reviewed a number of similar posts on the forum yet nothing is providing the results I am seeking. 

Is there some combination like KEY = "issue key" AND/OR portfolioChildIssuesOf (Key)? 

Or should the second field be childrenOfIssuesInQueryRecursive?

I've yet to find something that works

1 answer

0 votes
Kit Friend
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 16, 2024

childrenOfIssuesInQueryRecursive depends on scriptrunner I think @Derek Sekuler - if you've got that then yes

 

This should work fine for you though:

key = <YOUR TARGET ITEM> OR issue in portfolioChildIssuesOf (<YOUR TARGET ITEM>)

 

I always forget the exact syntax and end up googling - there's a handy article here: https://www.praecipio.com/resources/articles/jql-functions 

 

Depressingly GPT answered this precisely in 3 seconds after I'd bothered to manually type it up 😂  - here's the AI answer in case you'd like some fuller info: 

To create a JQL query that returns a parent issue and all its child issues in Jira, the approach depends on the setup of your instance and the add-ons available. Here's how to proceed:


Option 1: Native Jira JQL (Limited Functionality)

Out of the box, Jira's JQL doesn't natively support hierarchical queries like returning both a parent and its children (sub-tasks or portfolio-style children). However, you can manually combine criteria:

Example:

issueKey = "PARENT-123" OR parent = "PARENT-123"

This will:

  • Return the parent issue (PARENT-123) explicitly.
  • Include its sub-tasks or child issues if they have the parent field linked to that issue.

Option 2: Advanced JQL Using Portfolio Hierarchy

If you're using Jira Advanced Roadmaps (formerly Portfolio), you can leverage the portfolioChildIssuesOf function for higher-level hierarchy queries:

key = "PARENT-123" OR portfolioChildIssuesOf("PARENT-123")

This will:

  • Include the parent issue.
  • Fetch all children (like epics, stories, tasks, etc.) linked through Advanced Roadmaps.

Option 3: Recursive Queries Using Apps

For more complex queries (e.g., fetching children recursively for deeper hierarchies), Jira alone isn't enough. You need an app like ScriptRunner, JQL Search Extensions, or Structure.

ScriptRunner Example:

key = "PARENT-123" OR issueFunction in childrenOfIssuesInQueryRecursive('key = "PARENT-123"')
  • This will recursively fetch all issues related to the parent, including sub-tasks and deeper child levels.

Option 4: Combining Fields for Custom Relationships

If your hierarchy includes custom link types (e.g., "relates to," "is blocked by"), use issueFunction in linkedIssuesOf with ScriptRunner:

issueFunction in linkedIssuesOf("key = 'PARENT-123'", "blocks") OR key = "PARENT-123"

Key Notes:

  • Without add-ons, you’re limited to basic combinations of key, parent, or portfolioChildIssuesOf.
  • Recursive queries require an add-on, such as ScriptRunner or JQL Search Extensions.
  • If your instance uses team-managed projects, the hierarchy structure might differ, and sub-tasks might not follow the same parent field convention.

Would you like help refining your query further or exploring an add-on setup for deeper hierarchy support?

 

Derek Sekuler
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 16, 2024

Thank you!

Like Kit Friend likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events