Count the number of closed subtasks under an issue using smart values

Shamanth November 24, 2022

Hi,

I am trying to update a custom field on the parent issue based on the number of subtasks using the JIRA automation. So far, I was able to count the number of subtasks under the issue using {{issue.subtasks.size}} which is working perfectly!

I would now want to count the subtasks that are "Closed" and update the count in the parent issue. What combination of the smart field works for this?

3 answers

0 votes
Vinod Kotiya May 19, 2023

This is how I done by merging both solution. I am doing batch automation on 1000s of issues and its sub-tasks.

 

I got total subtask using {{issue.subtasks.size}}  

and number of done after lookup   {{lookupIssues.size|0}}

Capture.PNG

0 votes
Bill Sheboy
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.
November 24, 2022

Hi @Shamanth 

First thing, I am using Jira Cloud and not Server/Data Center.

As Jack notes, your version does not have Lookup Issues, so perhaps try the bulk-handling features with a JQL branch, and then use the {{issues}} smart value.  Note that one is plural to handle the issues as a set.

Please look here to learn about that feature: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html

Kind regards,
Bill

0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2022

Hi @Shamanth , welcome to the community.

See if you can work the following into your rule. Please note that the last action is simply a means of logging the value for test purposes. I'm unsure exactly what your action plans are such as email.

C726026D-31DB-4A77-BBFA-2C9866F6FDC6.jpeg

Shamanth November 24, 2022

Hello Jack,

Thanks for responding!

Let me explain about the 1st automation rule that I have successfully created. In this rule, I will be counting the total number of subtasks under the parent issue and update that number to a custom field named 'Total Findings' of the parent issue.

rule.png

 

Now I would like to replace the smart value {{issue.subtasks.size}} with another smart value that can count the number of subtasks with status=Closed. How can I achieve that?

Also, I tried replicating your rule, but unfortunately I could not find the Lookup Issues function.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2022

You can take what I gave you before and simply make your action be to edit the field of the parent with the smartvalue that I showed in the log action.

Shamanth November 24, 2022

I am sure that your solution would work, but I am currently on JIRA v8.20 and this lookup function is still not available to me. I am waiting for my organization to deploy the upgrade after testing. 

Any alternative solution you might be aware of?

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2022

Basically this but replace "Description" with your custom field.

FAD40FDA-C424-44BC-9D6B-1B1066AE9165.jpeg 

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2022

Ah....I missed that you are on server. It may be different but a bit surprised that what I show is not supported there. Can you try build the automation I suggested? Maybe, just as a test replicate exactly?

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2022

And no, I do not know of any alternative here.

Suggest an answer

Log in or Sign up to answer