Display total count of sub-tasks of the parent in custom field
Asked by Lakshmi S:

Hi Team,

How to display the sum of the count of all "sub-task" tickets to the Story or Bug issue type ticket in a specific custom field? The custom field on Parent ticket.

Ex : If the story has 11 sub-tasks, it will tally the 11 subtasks and exhibit the total as 11 in the Custom Field for the "Total Sum of subtasks"


Answers:
author: Luis Felipe Studzinski Santos
body: [@Lakshmi S](/t5/user/viewprofilepage/user-id/11952)

Hello,  
You can do it through automation. I'll send you an example automation, adjust your trigger and the field where you'll make the number of subs available.![Screenshot_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/337458i9AC599BF44FC4A03/image-size/large?v=v2&px=999 "Screenshot_1.png")![Screenshot_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/337459i37CCF34C44AEE24F/image-size/large?v=v2&px=999 "Screenshot_2.png")

comments: author: Lakshmi S
body: Thank you for your quick response [@Luis Felipe Studzinski Santos](/t5/user/viewprofilepage/user-id/5356722) . We want to filter the results using JQL, so that's the reason I want to store it in the field.


author: Luis Felipe Studzinski Santos
body: [@Lakshmi S](/t5/user/viewprofilepage/user-id/11952)

Yes, I understand your request. Instead of putting the value in the comments (here was just an example because there is no specific field) you can add the value of the variable by editing the field and putting the smart value in the field and thus use it in JQL or in a dashboard or even in a BI.


author: Anna Hryhoruk _Appfire_
body: Hello [@Lakshmi S](/t5/user/viewprofilepage/user-id/11952) ,

If you are considering using marketplace apps (or already have some), you can easily achieve this using [Power Custom Fields](https://marketplace.atlassian.com/apps/1210749/power-custom-fields-for-jira?tab=overview&hosting=datacenter)

Please refer to this page [SIL Script Custom Field](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15487363/PCF+-+SIL+Script+Custom+Field) .There, you will find an example of the same use case: [Showing the number of subtasks for a ticket](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15487363/PCF+-+SIL+Script+Custom+Field#Showing-the-number-of-subtasks-for-a-ticket)

Additionally, if you already have the [Power Scripts](https://marketplace.atlassian.com/apps/43318/power-scripts-jira-workflow-automation?hosting=datacenter&tab=overview) app in your Jira, it's also possible to set up something similar with a slightly different approach. If you're interested, please let me know.

Best regards,  
Anna


author: Hannes Obweger - JXL for Jira
body: Hi [@Lakshmi S](/t5/user/viewprofilepage/user-id/11952)

if you're open to solutions from the Atlassian Marketplace, you may want to have a look at the app that my team and I are working on, [JXL for Jira](https://marketplace.atlassian.com/apps/1224710?hosting=datacenter&tab=overview&utm_source=atlassian-community&utm_medium=referral&utm_content=2763373).

JXL is a full-fledged spreadsheet/table view for your issues that allows viewing, inline-editing, sorting, and filtering by all your issue fields, much like you'd do in e.g. Excel or Google Sheets. It also comes with a number of so-called *smart columns* that aren't natively available, including the *number of sub-tasks*.

This is how it looks in action:

![number-of-sub-tasks-v2.gif](https://community.atlassian.com/t5/image/serverpage/image-id/338350i97B323DA42839DB2/image-size/large?v=v2&px=999 "number-of-sub-tasks-v2.gif")

As you can see above, you can easily sort and filter by the number of sub-tasks. You can also use your smart columns across JXL's advanced features, such as support for (configurable) *issue hierarchies* , *issue grouping* by any issue field(s), *sum-ups* , or *conditional formatting*.

This all *just works* - there's no scripting or automation whatsoever required.

Any questions just let me know,

Best,

Hannes


author: Shawn Doyle - ReleaseTEAM
body: I'd attempt to do this via automation.

On creation of a new issue of type bug or story, check for parent, increment custom field on parent.


Tags: data-center

jira-data-center

scriptrunner