Advice on Linked Issues Condition for cross-project query
Asked by Mart Postma:

Hi all,  

I could use some advice on the following matter:  

**Context**We have a Jira Cloud project "ABC" and a Jira Product Discovery project "DISC". We want to receive an e-mail every week with a list of Epics that meet the following conditions:

* type = Epic
* component = XYZ
* project = ABC
* label = discovery
* has **no** link "implemented by" or "implements" with the DISC project

The idea here is that we get a list containing all Epics of the XYZ component with label "discovery" from the ABC project **without**a link to the DISC project.

**Current setup**

Right now, in the "When" component, we query:

```
type = epic AND project = ABC and component = XYZ and label = "discovery"
```

Then we use the "If: Linked issues match" condition like this to find the linked issues in the DISC project: (and here I think we made a mistake, but I can't figure out what)

![2023-10-17_10-47-12.png](https://community.atlassian.com/t5/image/serverpage/image-id/286650iBCAA6989D7E608CD/image-dimensions/383x311?v=v2 "2023-10-17_10-47-12.png")

Overview:

![2023-10-17_10-44-06.png](https://community.atlassian.com/t5/image/serverpage/image-id/286651i4ECA78399EB95F1C/image-size/large?v=v2&px=999 "2023-10-17_10-44-06.png")

**Question**

The main question here is simply: is it possible to automate our request, without any usage of for example Scriptrunner or external plug-ins?  

As a side question: if possible, how can I make the "Then: Send email" send me only 1 mail with a list, rather than a separate email for each Epic found.  

Thanks for helping out.


Answers:
author: Bill Sheboy
body: Hi [@Mart Postma](/t5/user/viewprofilepage/user-id/5313648)

First thing, this will be much easier if you have one of the marketplace addons to enhance JQL features. As you prefer not to do this, some possible work-arounds are...

(A) You could export all of the epics to a spreadsheet weekly, filtering out the ones missing the links of interest, either your types or the Polaris Issue Link that Jira Product Discovery (JPD) uses

(B) You could build something outside of Jira, which uses the REST API functions to get issues and perform the joins / queries more easily than inside of Jira

(C) A complicated automation rule (although I have not tried this approach) using either Lookup Issues or a Send Web Request to...

* first find all of the epics with no links (i.e., issueLinkType IS EMPTY), and union that result with...
  * find all epics with links
  * identify the ones linked to the JPD project, and use that to create a dynamic regular expression to exclude them, by issue key, storing that in a created variable
  * use the match() function with that variable to return the remaining issues
  * I suspect the most challenging part of this will be getting the regular expression to work. And, this approach will be limited to 100 epic issues due to the limitations in rule processing.
* send your email with the results

(D) Simpler automation rule, which is triggered in any project with epics, when an epic is linked to an issue. Add an indicator (e.g., label, custom field, etc.) to indicate the epic is linked to a JPD idea, and to remove it when the link is removed. That custom field (or label) could then easily be searched with JQL to find the epics, and used in a filter subscription to send the email.

Kind regards,  
Bill

comments: author: Mart Postma
body: Hi Bill, thank you very much for the elaborate answer.

I think I will try them all and see what works best for us. Regarding to my last question, do you have any suggestion on how to solve that issue? Or is it only possible to get 1 e-mail if you subscribe to a filter, rather than using automation?

Thanks!


author: Bill Sheboy
body: Options (A), (B), and (D) allow you to manage how to communicate the results.

For option (C)...As you are using Jira Cloud, the Lookup Issues action of automation rules will allow you to both gather the issues as a group and to send one email, listing them. Please look here to learn more about that action: <https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues>