Forums

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

A request that shows all objects that have three and more sub-bugs.

Alex Gavrysh
Contributor
September 14, 2023

Hello!

Could you please help with the query that returns objects that have three and more sub-bugs.

I may query all sub-bugs: issuetype in ("Bug Sub-Task")

I may query all objects that has 3 and more sub-tasks (including both "Bug Sub-Task" and "Sub-Task"): numberOfSubtasks >= 3

But how I may query the number of exactly sub-bugs?

2 answers

1 accepted

1 vote
Answer accepted
Hauke Bruno Wollentin
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.
September 14, 2023

You could try something like

AND issueFunction in subtasksOf("type = Sub-Bugs")
Hauke Bruno Wollentin
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.
September 14, 2023

Sorry the above doesn't make sense, but filtering just for the type won't do?

Alex Gavrysh
Contributor
September 14, 2023

Unfortunately no.

I need all objects that have three and more sub-bugs. I may filter by objects that have three and more sub-tasks. But I need not sub-tasks, but sub-bugs (custom subtask) 

Like Hauke Bruno Wollentin likes this
Hauke Bruno Wollentin
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.
September 14, 2023

Well I see... since ScriptRunner is a bit limited in Cloud, maybe a pretty dirty workaround could be:

Create a job or listener that counts all Sub-Bugs and write them as a _metric_ in a number custom field into the parent issue.

You than could just filter for that number custom field.

Like Alex Gavrysh likes this
Alex Gavrysh
Contributor
September 18, 2023

Thank you! I will try to go this way.

Like Hauke Bruno Wollentin likes this
0 votes
Margo
Contributor
September 14, 2023

Hi @Alex Gavrysh 

I think 'Sub-task' in 'numberOfSubtasks' refers to issue type hierarchy level (all sub-issue types have it -1, 'general' issue types - 0 and Epic - 1). So it will take into consideration all issue types that have -1 hierarchy, in your case probably only subtasks (system issue type) and bug sub-tasks (custom issue type created in your instance). I doubt you can distinguish different issue types with -1 without any add-on.

BR,

Margo

Alex Gavrysh
Contributor
September 14, 2023

We have ScriptRunner. But I cannot find a proper function.

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