Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JQL for certain Epic parents

Mykenna Cepek
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.
January 27, 2023

"Initiative" seems to be the most common issue type above Epic. So let's talk about Epics that are children of Initiatives.

I'm looking for a query (JQL) that will give me just the Initiatives that are parents of the Epics in a given project. For example:

  • Initiative IN-123 has two child Epics ABC-100 and ABC-200.
  • Initiative IN-124 has child Epics ABC-300, QQ-150 and ZZ-250.
  • Initiative IN-125 has child Epics ZZ-350 and ZZ-450.

I want a JQL query that will list just IN-123 and IN-124 for project ABC.

A similar JQL query for project QQ should return just IN-124.

So this JQL is solving for "All the initiatives that are parents of Epics in a given project".

The solution needs to NOT specify the exact Epics or Initiatives of interest, but find them dynamically. So, for example, if IN-125 gains a child Epic from the ABC project, the query for the ABC project should now return three Initiatives.

I don't see a way to do this in baseline Jira (Data Center, in my situation). We happen to also have the PowerScripts and ScriptRunner add-ons. But I don't see how either of them can solve this problem either.

A proper solution should be usable by Project Admins. Solutions like the Script Console in ScriptRunner require a Jira Admin, and I'm less interested in those.

Our large organization needs this in order to scope Jira Plan (Advanced Roadmap) configurations to show only the Initiatives that relate to each team/project.

2 answers

1 accepted

2 votes
Answer accepted
Mykenna Cepek
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.
March 8, 2023

Adaptavist support (the folks who make ScriptRunner) suggests that a likely cause is a conflict in function names between multiple Jira add-ons. Documentation on the topic here.

That seems likely to explain what's going on. I'm offering this partial solution while I wait for our Jira Admins to explore solutions in our instance. It's not clear if the functions in another add-on can be disabled to eliminate the conflict with the ScriptRunner functions I want to use.

I'll update here once things get fully resolved for me.

Mykenna Cepek
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.
March 9, 2023

I mentioned in my OP: "We happen to also have the PowerScripts and ScriptRunner add-ons." This turned out to be a key to the solution.

We did have function name conflicts due to multiple Jira add-ons being installed. A Jira Admin disabled a couple of PowerScript functions, and I can now use the ScriptRunner functions.

Kudos to Adaptavist support for helping us resolve this fairly quickly (although I feel their documentation might have called out this known potential problem more clearly).

Like Trudy Claspill likes this
0 votes
Clark Everson
Community Champion
January 27, 2023

Hi @Mykenna Cepek 

If you have the correct scriptrunner functions enabled you can do this but if not enabled they would need to be enabled by an admin

issueFunction in parentsOf() should work if i remember correct

Inside the () you have to write another JQL function inside "" and then where ever you would use "" in your normal jql expression use '' instead

What I tend to do is write my JQl expression i want in the quotes first then add the scriptrunner part

 

Best,

Clark

Trudy Claspill
Community Champion
January 27, 2023

In ScriptRunner for Jira DC, parentsOf is for getting parents of subtasks.

https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/sub-tasks#id-.Subtasksv6.36.0-parents

To get parents of items from Epics upwards you need to use portfolioParentsOf

https://docs.adaptavist.com/sr4js/latest/features/jql-functions/included-jql-functions/portfolio

Like Bill Sheboy likes this
Mykenna Cepek
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.
January 31, 2023

It's not clear to me if some ScriptRunner functions aren't enabled or what. I have project-admin privs (not Jira admin privs), so how would I know?

I can say that many functions like parentsOf() and portfolioParentsOf() do not appear in the auto-complete when I'm constructing JQL:

01.png

And when I try to use them to return even the most basic, known things, they seem to quietly fail:

02.png

I see also that the ScriptRunner documentation linked earlier makes it clear that:

03.PNG

Of course it hasn't been called that for years, having been renamed "Advanced Roadmaps" and now "Plans". Whatever it is, it's definitely part our our Jira Data Server instance, as many teams are using Jira Plans for their roadmapping efforts.

I can't help but call out (strongly) that basic issue hierarchy traversal like this should be a built-in feature for Jira. I realize the historical messiness (subtask parents aren't like story parents, etc). But not being able to use JQL (without add-ons) to find the parent of an issue is ridiculous. But enough pointless complaining.

We've got the add-ons. Why aren't they working?

Trudy Claspill
Community Champion
January 31, 2023

Hello @Mykenna Cepek 

Looking at your latest images, your subfilter is wrong, I think.

Where you are using ("key=7133") you should be using ("key=ET-7133")

Like Mykenna Cepek likes this
Mykenna Cepek
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.
February 9, 2023

Still nothing:

searching.png

That last query was to convince myself that whatever was after "in" really mattered.

ET-7133 exists, is an Epic, and has a Feature issue as a parent.

Trudy Claspill
Community Champion
February 9, 2023

Can you show us a screen image from the roadmap that shows ET-7133 as a subordinate issue under another issue?

Mykenna Cepek
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.
February 20, 2023

Untitled.png

Trudy Claspill
Community Champion
February 21, 2023

I am less familiar with the roadmap functionality in Jira on-prem, so some of my questions/suggestions may be off base.

Was making ET-7133 a subordinate of DPMWM-177 a recent change?

If you look directly at the details of the ET-7133 issue, do you see that it contains a link to the DPMWM-177 issue?

If you try the same filter and plug in ET-6841 instead, do you get any results?

Has a full re-index been performed lately? I saw this comment in the ScriptRunner document:

After first install the version of ScriptRunner containing these functions [portfolio functions], a full reindex is required, otherwise they will only show results for issues updated from that point.

Like Mykenna Cepek likes this
Mykenna Cepek
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.
February 24, 2023

Was making ET-7133 a subordinate of DPMWM-177 a recent change?

reparent.png

 

If you look directly at the details of the ET-7133 issue, do you see that it contains a link to the DPMWM-177 issue?

Yes, both '7133 and '6841 show this:

parent177.PNG

 

If you try the same filter and plug in ET-6841 instead, do you get any results?

Nope:

parent6841.png

 

Has a full re-index been performed lately?

We normally re-index every 2-3 weeks. ScriptRunner was installed years ago.

The admins also tell me that a "background re-index" occurs at 2am daily.

 

I also noticed this interesting result, suggesting that the parentsOf() function is available (since it can tell when such a function isn't available):

noFunc.PNG

Mykenna Cepek
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.
February 24, 2023

To reiterate my question:  why can't I get the parentsOf() function to work?

Like # people like this

Suggest an answer

Log in or Sign up to answer