Forums

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

Get List of Issues only if Sub-tasks have particular Status

bravedj September 10, 2020

Hi, How do we get list of Stories which have Sub-Tasks with specific status.

Ex:

US# 1234 has 10 Sub-tasks with all of them in Cancelled Status.

US# 3456 has 10 Sub-tasks with 5 Tasks in Cancelled and 5 in To Do.

So When I run the query, I want the list to produce only US# 1234. (I want to exclude Stories if any of the sub-tasks under that story has other than Cancelled status.

I tried with below query: But it still returns 3456 also.

project = ABCD and issueFunction in linkedIssuesOf("status not in ('To Do', 'Done', 'In Progress') and issuetype=sub-task") and resolution is empty

1 answer

1 accepted

1 vote
Answer accepted
Tansu Akdeniz
Community Champion
September 11, 2020

Hi @bravedj 

Welcome to community.

If you have Script Runner add-on, the following query will work.

type = Story and not issuefunction in parentsOf("status != Cancelled")

It will return US# 1234 issue. Because it is a Story and it has sub-tasks with all of them in Cancelled Status.

Regards

bravedj September 11, 2020

Thank you so much!
By anyway, we can exclude the Stories which do not have any sub-tasks?

Right now above query returns other Stories which do not have any Sub-tasks also.

Tansu Akdeniz
Community Champion
September 11, 2020

You are welcome. 

Please use this one:

type = Story and not issuefunction in parentsOf("status != Cancelled") and issueFunction in hasSubtasks() 
Like Angela Lim likes this
bravedj September 11, 2020

Worked perfectly!

Thank you for your help!

Now I see all other functions in Scriptrunner, I will explore more. Appreciate the help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events