JQL Query pull subtasks w/ two specifics projects (epic in one)
Asked by Lukas:

Hello I have to different projects that I'm trying to view together in a board.

I was given this however AV has over 20k issues :D and all I need is AV-12345 (epic and all subtasks) and then all items under project MAF....how could I edit jql query below for that or should i have something else? Thanks a lot for your help. JQL without the lines is much harder for me to understand than SQL.

(project = AV AND issuetype = Epic OR issueFunction in issuesInEpics("project = AV AND issuetype = Epic") OR issueFunction in linkedIssuesOfAll("project = AV AND issuetype = Epic")) AND resolution not in (Canceled, Cancelled, "Won't Do", "Won't Fix", Duplicate)


Answers:
author: Trudy Claspill
body: Hello [@Lukas](/t5/user/viewprofilepage/user-id/5550970)

Welcome to the Atlassian community.

To get the specific issue AV-12345 start with:

issue = AV-12345

To add to that all the child issues and their subtasks under that Epic:

issue = AV-12345 or issueFunction in childrenOf("issue = AV-12345")

To then also include all items from project WAF:

issue = AV-12345 or issueFunction in childrenOf("issue = AV-12345") or project=WAF

The sample JQL you shared is really quite different from what you specified as your requirement. It is pulling in issues that are linked to other issues. It is also constraining the results to only issues that have a value in the resolution field. I assume it is not giving you anything close to what you stated as your requirement. In such a case it is better to start from scratch and work through each piece of your requirement one at a time.

You can find information on JQL capabilities here:

<https://support.atlassian.com/jira-software-cloud/docs/use-advanced-search-with-jira-query-language-jql/>

You also showed "issueFunction" in your sample JQL. That is not a native feature of Jira and indicates you likely have ScriptRunner available in your instance. You can find information about using ScriptRunner in JQL here:

<https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/scriptrunner-enhanced-search-jql-queries>

comments: author: Lukas
body: Thank you for the answer...  
I think to complicate matters most seem to be linked not child of or linked with etc. The jql is pulling everything within project AV that i want i just wanted to add MAF to it to be more speicfic....sql has lines this really doesn't so i don't know where I can add to the segment to add your "or project = waf". Any ideas? Thanks so much


author: Trudy Claspill
body: I don't think I yet understand your requirement.

Are you saying the original query gives you want you want, but you want to reduce it to only giving your linked issues that are in MAF?

I like to use indentation to help me understand what complex statements are doing.

```
(
  project = AV AND issuetype = Epic OR 
  issueFunction in issuesInEpics("project = AV AND issuetype = Epic") OR 
  issueFunction in linkedIssuesOfAll("project = AV AND issuetype = Epic")
) 
AND 
resolution not in (Canceled, Cancelled, "Won't Do", "Won't Fix", Duplicate)
```

Your query is current selecting only issues that are Resolved and have a Resolution value that is not in the list (Canceled, Cancelled, etc.)

It further limits the results so that they have to be in one of three groups.

1. The issue is in project AV and it is an Epic, or

2. The issue is a child of an Epic in project AV, or

3. The issue is linked in any way to an Epic in project AV

Please try to explain how you want to output to change when MAF is added to the mix.


author: Lukas
body: Sorry i think the resolution not in "canceled, cancelled, "won't do, etc is fine  

I just want to pull all items under MAF, and AV with all links( child, linked, subtask, etc) to show under these projects:   
Except:   
MAF I want to pull all data

for AV I want to pull all data under epic = AV34356

thanks,   
lukas


author: Trudy Claspill
body: Thanks for that clarification.

Then the simplest thing to do is tack that on at the beginning and put your original query in parentheses:

**project=MAF OR (** original query **)**

**project=MAF OR (** (project = AV AND issuetype = Epic OR issueFunction in issuesInEpics("project = AV AND issuetype = Epic") OR issueFunction in linkedIssuesOfAll("project = AV AND issuetype = Epic")) AND resolution not in (Canceled, Cancelled, "Won't Do", "Won't Fix", Duplicate) **)**


author: Lukas
body: Thank you so much this makes it clear :) I'll start working on this Monday. I like how you split it, it makes much better sense now :)

Cheers,

Lukas


Tags: cloud

jira-cloud