Forums

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

Count the number of subtasks in To Do status

simarpreet singh
Contributor
May 4, 2020

Hi guys,

I need to find a way to count the number of subtasks under an epic which are in To Do status. Later on I'll use that count to run a post function which will based on the criteria that if count<10, then create a clone of subtask, else not.

I would prefer if we have a post function or condition there to do so. Not in favour of scriptrunner.

Thanks in advance

4 answers

2 accepted

0 votes
Answer accepted
Bibek Behera
Community Champion
May 4, 2020

@simarpreet singh  did you try using a JQL and get the count from there? You can take a note from https://community.atlassian.com/t5/Marketplace-Apps-Integrations/How-to-get-all-users-story-and-sub-tasks-under-user-story/qaq-p/272507

 

Too lazy to get all the content from there :) 

 

-Bibek

simarpreet singh
Contributor
May 4, 2020

Hi @Bibek Behera - I already have JQL with me, but not going with that considering there are 14k issues to search for in JQL that can significantly affect the jira performance.

0 votes
Answer accepted
Radhika Vijji _Innovalog_
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.
May 4, 2020

Hi Simarpreet,

Look if you have Jira Misc Custom fields (https://innovalog.atlassian.net/wiki/x/6hp1C) of Innovalog in your instance. It provides Calculated fields that count the number of subtasks in a specific status on-the-fly. 

Regards,

Radhika

simarpreet singh
Contributor
May 4, 2020

Hi @Radhika Vijji _Innovalog_ - It looks great. But I'm not able to find the exact code to have for calculating the number of tasks I have under epic which are in TO DO status right now! I would really really appreciate your help if you can specifically provide that code snippet.

Background:

There are 1400 epics, each representing a user. Each epic (or user) has 40 to 50 tasks. Now I want to rollup all the to do tasks, currently at the moment , to that specific epic.

Many thanks.

Radhika Vijji _Innovalog_
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.
May 4, 2020

Sure Simarpreet. Where is your Jira hosted? Server or Cloud? JMCF is available for Jira Server only. Where you able to see Jira Misc Custom fields in your instance? If yes, this is what you might want to do:

  1. Create a Calculated Number field, "Subtasks in To Do"
  2. After creating the field, locate the field on the Custom fields page
  3. Click on cogwheel for the custom field
  4. Click on Configure
  5. Click on Edit Groovy Formula
  6. Input the following Groovy formula 
  7. issue.subtasks.findAll{it.status.name == "To Do"}.size()
  8. Click on Save.
  9. Since this applies to an issue of issue type "Epic" you can configure the custom field to be applicable to just the issues of issue type "Epic".
  10. Perform a re-index as suggested by Jira.

Now on all the Epics, you will see the count of subtasks in "To Do" status under the Epic. You can also use these in searches on the Issue Navigator and statistics in the Gadgets.

Regards,

Radhika

simarpreet singh
Contributor
May 4, 2020

Hi @Radhika Vijji _Innovalog_ Ma'm your solution seems really promising and I believe it is what I need! But I'm not able to locate groovy editor as you mentioned. See below:

ss4.PNG  

Do I need to make any config changes?

*Also under epic, we have tasks and shift issue types. Shift is a custom issue type we created.

Thank you so so much

Radhika Vijji _Innovalog_
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.
May 4, 2020

Hi Simarpreet,

The custom field does not look like a JMCF custom field. Please share a screenshot of the Manage add-ons page showing Jira Misc Custom Fields add-on. You need to have a version above 2.0.0 (paid) of the add-on. And here is the installation guide: https://innovalog.atlassian.net/wiki/x/JoBVB.

Regards,

Radhika

simarpreet singh
Contributor
May 5, 2020

Hi Radhika,

Unfortunately, the fields we have is JWT. We are planning to have JMCF as well now by next quarter. Your solution has been liked by so many and this seems a sure shot.

Although, I have figured out an alternative solution to my problem anyhow.

Thanks again for your help.

Regards,

Simar

3 votes
Thorsten Letschert _Decadis AG_
Atlassian Partner
May 5, 2020

Hi @simarpreet singh ,

the matching expression for JWT is as simple as

count(filterByStatus(issuesUnderEpic(),"To Do"))

If you want to add it as a conditional execution to a post function, the expression could look like

count(filterByStatus(issuesUnderEpic(),"To Do")) < 10

Cheers
Thorsten

0 votes
Serge DUDNIC
Contributor
December 20, 2022

serious? it is so HARD to say how many todo tickets are ?

it is not the basic function of the JIRA to say what volume of work remain? should I learn the query language to have such a basic stat in a project?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events