Home / JQL functions / ancestorsOf()
ancestorsOf() JQL function for Jira Cloud
Last updated 20/11/2026. Hooks is our product, and this page describes how its built-in function behaves.
ancestorsOf() returns the parents, grandparents and every further level above the work items your inner JQL matches. Syntax: issue in ancestorsOf("jql"). It is the whole chain upwards, where parentsOf stops at the direct parent. Use it for roll-up views in saved filters, boards and dashboards.
Syntax
issue in ancestorsOf("jql")
Parents, grandparents and so on up the hierarchy of the matches. The function name is not case sensitive in the search bar, and you can use it anywhere Jira accepts JQL: the search bar, saved filters, boards, dashboard gadgets and subscriptions.
Arguments
| Argument | What it does |
|---|---|
jql | Required. A JQL query. The function walks up from everything it matches. |
What it returns
Jira lets you filter a work item by its own fields, but not by the fields of its parent chain. ancestorsOf flips the question: find the work items that matter, then ask for everything above them. Teams use it to answer "which initiatives are these bugs ultimately under?" without clicking through each level.
Three worked examples
Board filter: epics and stories behind open bugs
issue in ancestorsOf("project = WEB AND issuetype = Bug AND statusCategory != Done")
A roadmap board showing only this filter lists every parent level above the open bugs, so product owners see which features are carrying defects.
Dashboard gadget: initiatives with blocked work
issue in ancestorsOf("project = ACME AND status = Blocked")
Put this in a filter results gadget on the portfolio dashboard. Each row is a parent or grandparent of something blocked, which is where managers can intervene.
Automation: flag parents of overdue work
issue in ancestorsOf("project = PLAT AND duedate < now() AND resolution is EMPTY") AND labels is EMPTY
A scheduled automation rule can add an "at-risk" label to every ancestor that has not been flagged yet, so roll-up reports pick it up.
Saving it as a filter
There is nothing app-specific to save. Compose the query in Jira's own search bar, save it as a normal Jira filter, and use that filter on boards, dashboards, gadgets and subscriptions. The JQL functions tab in Hooks has a Try a search panel that previews the first matches of a query before you save it, which is a quick way to check the inner JQL does what you expect.
Using not in
Every built-in function returns the correct set for not in. issue not in ancestorsOf(...) matches every work item except the ones the function returns.
issue not in ancestorsOf("jql")
Limits you will see
- The inner search scans up to 25,000 matches and the function returns up to 12,000 work items.
- A bigger result shows too many results. You never get a silently cut-off list.
- Results refresh within about 5 minutes of a change to your data.
- A search with an invalid inner query degrades to a no-match result, so a saved filter keeps working.
ScriptRunner equivalent
In ScriptRunner you write issueFunction in ancestorsOf(...). In Hooks you write issue in ancestorsOf(...), and issueFunction not in becomes issue not in. ScriptRunner writes this as parentsOf("jql", "all"). Migrated filters convert it to ancestorsOf("jql") for you. Saved Enhanced Search filters can be converted in place from the Migrate from ScriptRunner tab, which checks each one against ScriptRunner's current results first. See the migration docs and the Enhanced Search alternative guide.
Related functions
- parentsOf() - The parents of the work items the inner JQL matches.
- descendantsOf() - Every level of work items underneath the matches, optionally only those matching a filter.
- epicsOf() - The parent epics of the work items the inner JQL matches.
- All 15 built-in JQL functions, plus
hooked()for your own
Frequently asked questions
What is the difference between parentsOf and ancestorsOf?
parentsOf returns the parents of the matches. ancestorsOf returns the whole chain upwards: parents, grandparents and so on.
Which ScriptRunner query does this replace?
parentsOf with the "all" argument. Write issue in ancestorsOf("jql") instead.
How many work items can ancestorsOf() return?
Up to 12,000. The inner search scans up to 25,000 matches, and a bigger result shows too many results instead of a cut-off list.
What is the ScriptRunner equivalent of ancestorsOf()?
Replace issueFunction in with issue in. ScriptRunner writes this as parentsOf("jql", "all"). Migrated filters convert it to ancestorsOf("jql") for you.