Dynamic JQL Query to Retrieve Linked Initiatives from other Projects in Jira Plan
Asked by Chris K:

Dear Atlassian Community,

We are currently working with Jira Plans using different board filters as issue sources. Specifically, we are pulling in a selection of issues from Project "A," including Initiatives, Epics, and Tasks.

However, we are facing a challenge:

Some Epics in Project A are linked (via the Parent Link field) to Initiatives that are part of other Jira projects. These Initiatives do not appear on the Roadmap because the filters only include issues from Project A and we are facing unassigned Epics in the Roadmap.

Our goal is to create a JQL query that dynamically retrieves all Initiatives from the other projects that are linked to Epics within Project A.

We've tried different approaches using the linkedIssues function in JQL, but failed. We would appreciate any guidance on how to construct a dynamic JQL query (preferably using ScriptRunner or another method) to achieve this. Our ideal outcome is to have the Roadmap display all relevant Initiatives from other projects that are linked to Epics from Project A.

Thank you in advance for your help!

Best regards,

Chris


Answers:
author: Florian Bonniec
body: Hi [@Chris K](/t5/user/viewprofilepage/user-id/5117457)

You could use the following function portfolioParentsOf

issueFunction in portfolioParentsOf("project = A and type = Epic") and type = Initiative

But in order to work with AR, I recommand to add filterring on the projects you are expecting to have Initiatives, otherwise you will reach the 100 project limit of AR.

Regards

comments: author: Chris K
body: Hi [@Florian Bonniec](/t5/user/viewprofilepage/user-id/495589)

Thank you for your quick response. This solution works just perfectly for our use case! :)

Kind regards,

Chris


author: Prosper Agwegiokhe
body: Hi [@Chris K](/t5/user/viewprofilepage/user-id/5117457) ,

I'm Prosper, a support engineer at Appfire, and I'm here to help you.  
Unfortunately natively, you'll not be able to do it dynamically.

In the app where 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 this query, to find the initiatives in the project A:

```
issue in parentsOfIssuesInQuery("project='A' and type=Epic")
```

Or use this query below to get the initiative linked to epics in project A:

```
issue in linkedIssuesOfQuery("project='A' and type=Epic") and type = Initiative
```

Please contact our [support](https://appfire.atlassian.net/servicedesk/customer/portal/11) if you have any other questions about this query.

We'll be happy to help you!

Best regards,  
Prosper.

comments: author: Chris K
body: Hi [@Prosper Agwegiokhe](/t5/user/viewprofilepage/user-id/5221640)

Thank you for your help! The provided solution by [@Florian Bonniec](/t5/user/viewprofilepage/user-id/495589) solved the case for us, therefore we won't need the add-on. Thank you! :)

Kind regards,

Chris


Tags: data-center

jira-data-center

jira-server

jql

power-scripts

scriptrunner

server