Forums

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

JQL query for Issues in Epics linked to current Epic

Ahmad Sidawi
Contributor
July 18, 2023

I have an edge use case where a user is looking to create a query of all issues related to several epics. These epics are all linked through an issue link to a 'source epic' and we want to find all tasks under all related epics. Is this possible through JQL or one of the apps such as Scriptrunner/JQL extensions?

 

Thanks

3 answers

1 accepted

1 vote
Answer accepted
Romy Greenfield
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.
July 18, 2023

Hi Ahmad

You can use ScriptRunner Enhanced Search or the standalone Enhanced Search app to do this, using our issuesInEpics function. If your source epic is called "EPIC-1" and your link type is "relates to" you can use the following query on the Enhanced Search page:

 issueFunction in issuesInEpics("issue in linkedIssues(EPIC-1, "relates to")")

If you are specifically looking for tasks, you can add the task type to further filter your results

issueFunction in issuesInEpics("issue in linkedIssues(EPIC-1, "relates to")") and type = Task

Best regards, 

Romy

Ahmad Sidawi
Contributor
July 20, 2023

That should do it :) 

Like Romy Greenfield likes this
1 vote
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 18, 2023

Hi @Ahmad Sidawi

You have 2 approaches to get this information. The first is by using the Enhanced Search from ScriptRunner for Jira Cloud and using this query:-

issueFunction in issuesInEpics("project = MOCK and key in ('MOCK-19')")

Modify the project key accordingly and issue keys accordingly.

If you are not using the Enhanced Search, then you will need to run the JQL Query like:-

(parentEpic in (11500, 11498) AND issuetype != Epic)

The numbers 11500 and 11498 are the Epic issue ids. To get the Epic Ids, you will need to run the query below on the ScriptRunner console:-

def issueKey = 'MOCK-19' //Change the Epic Key according to your environment

def result = get("/rest/api/2/issue/${issueKey}").header('Content-Type', 'application/json').asObject(Map)

 The output returned will be something like:-

{
  "headers": {
   .....
..... }, "statusText": "OK", "parsingError": { "empty": true, "present": false }, "body": { "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations,customfield_10095.properties,customfield_10096.properties,customfield_10010.requestTypePractice", "id": "11500", "self": "https://<YOUR_URL>.atlassian.net/rest/api/2/issue/11500", "key": "MOCK-19",

....
....
....
}

 You must use the id value, as I have shown in the JQL query, to get your linked issues.

I hope this helps solve your question. :-)

Thank you and Kind regards,

Ram

Ahmad Sidawi
Contributor
July 18, 2023

@Ram Kumar Aravindakshan _Adaptavist_ so in the approach above i have to know the Epic ID's through a separate query. Is there not a way to get the data without knowing the Epic ID's or Keys?

We have TICKET-1 linked to TICKET-2 and both has tasks underneath, but i only know TICKET-1's key.

0 votes
Ahmad Sidawi
Contributor
July 18, 2023

A note as well, we should assume we don't know the keys of the related epics, and only have the source epic.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events