Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can you automatically sum the story points of all subtasks?

Edited

I want the Story Points field for the parent story to be the sum of the sub-tasks.

I tried using the {{triggerIssue.Story Points}} + {{issue.Story Points}} option but that continues to add if we adjust.Screen Shot 2018-08-08 at 3.53.22 PM.png

Example:

Subtask A = 12

Subtask B = 10

Story 1 = 22

This is fine so far...

Subtask A: 12 -> 15

Story = 37 (not 25 like it should)

I want it such that whenever I update a sub-task estimate, it queries all subtasks and adds their story points OR if it detects a change, subtracts the previous value, and adds the new value,

 

 

 

9 answers

1 accepted

9 votes
Answer accepted
John McKiernan Marketplace Partner Aug 08, 2018

Hi Eric,

thanks for your message.

You should be able to use {{subtasks.Story Points.join(" + ")}}

Let me know if that doesn't work for you!

Cheers,

John

It works well, thanks! Where can I find good documentation about that?

Like # people like this
John McKiernan Marketplace Partner Aug 08, 2018

Good to hear! 

We do have some docs around the smart fields here:

https://docs.codebarrel.io/automation/smart-fields/working-with-lists.html

However, truth be told, they are not as comprehensive as we would like.

I am in the process of putting together more detailed docs, vids, and webinars over the next few months. In the meantime, feel free to reach out if you run into any roadblocks! 

Cheers,

John 

Like Thomas.Burgess likes this

Hi,

I had tried using 

"{{subtasks.timetracking.originalEstimateSeconds.join(' + ')}}"

and 

"{{subtasks.originalEstimateSeconds.join(' + ')}}"

 

but non of above working It shows below error

 

Error while rendering additional fields.Invalid method call syntax

 

and on top of that got one question.

If originalEstimate is in day/min/hrs/week then how It will work?

subtasks.originalEstimate.join(' + ')

 

 

Hi, I just discovered this post.

I've been trying to get story points for an EPIC to sum from multiple Tasks linked using the EPIC link. I've tried the suggestion {{subtasks.Story Points.join(" + ")}} and also used {{issue.Story Points.join(" + ")}}. Using Smart values doesn't appear to work when I JIRA automation rule.. Any suggestions as to why this wouldn't work?

Thanks

Ged 

John McKiernan Marketplace Partner Nov 13, 2018

Hi Ged,

At the moment, this isn't possible with Automation for Jira. 

We have an existing improvement issue here which I have added your vote to: https://codebarrel.atlassian.net/browse/AUT-475

If you are new to smart values within automation for jira, here are two good resources to help:

Docs:  https://docs.automationforjira.com/smart-fields/smart-fields.html

Blog: https://docs.automationforjira.com/smart-fields/smart-fields.html

Hope that helps!

Cheers,

John 

Please add my vote

Like John McKiernan likes this

Any updates on this?

Kavit, i have a response: 

{{#=}}{{#=}}{{subtasks.timetracking.originalEstimateSeconds.join(" + ")}}{{/}}/3600{{/}}

Like Martin_Kleine likes this

Thanks JC! With following adjustment, I was able to now sum up the estimates of all subtasks.


{
    "fields": {
        "timetracking": {
            "originalEstimate": {{#=}}{{#=}}{{subtasks.timetracking.originalEstimateSeconds.join(" + ")}}{{/}}/60{{/}}
        }
    }
}

UH? as a non techy person I have no idea where this code is supossed to go 

Like Denise_Moraes likes this

In the Additional Fields text box.

 

See screenshot 

By the way, I finally got it to work for me by using this code shared above.

 

{
"fields": {
"Story point estimate": {{#=}}{{subtasks.Story point estimate.join(" + ")}}{{/}}

}
}

 

However, I had to adjust the "Story point estimate" part because we're actually using a custom field called "Story Points" for this for some reason. This took me a while to figure out. In the end what helped me was this article here: https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/ There is a paragraph on "Referencing issue fields" which showed what it needs to look like for custom fields. So in my case the code now actually looks like this:

 

{
     "fields": {
           "customfield_10021": {{#=}}{{subtasks.customfield_10021.join(" + ")}}{{/}}

     }
}

I hope this can also help some other people ;) 

You're amazing @Stefanie Häuser !! I've tried so hard to make this work and you help me a lot! Your solution works for me as well!

Thank you very much for share with us :) 

Thank you SO much @Stefanie Häuser !

I have one further issue - perhaps someone of you has a solution.

In our team, we are using this rule to work more smoothly with Jira. The developers don't have to remember to update the Story Points of a Story when there is change in the subtasks (e. g. new subtasks, other amount of Story Points, etc.)

This rule works perfectly for us als long as we don't have a 'Done' subtask in our story.
The goal is, Subtasks with Status = 'Done' shouldn't be included in the calculation. How can I add this condition into my automation? 

 

You can see my actual try in the screenshot. The result is, that as long as there is a subtask with the status = 'Done', it won't calculate anything (which makes sense in my opinion)

Bildschirmfoto 2020-05-15 um 17.30.52.png


 

Any ideas? :)

@Stefanie Hausner 

I'm getting a JSON error.  any thoughts?

{
"fields": {
"Story point estimate": {{#=}}{{subtasks.Story point estimate.join(" + ")}}{{/}}

}
}

sorry for necro.

 

For next-gen, {{subtasks.Story Points.join(" + ")}} will not work properly.

Use "Story point estimate" .

{
"fields": {
"Story point estimate": {{#=}} {{subtasks.Story point estimate.join(" + ") }} {{/}}
}
}

or

{
"fields": {
"Story point estimate": {{#=}} {{#subtasks}} {{Story point estimate}} + {{/}} 0 {{/}}
}
}

 

Looks like this

Screen Shot 2020-08-15 at 23.05.04.png

Screenshot 2020-10-05 at 5.16.05 PM.pngDid any one face this issue ?

Like susan hsieh likes this

I did. Did you solve this ?

Hi  @Rafael Hideaki Teruya 

I face this issue too.

My project is next-gen Jira software project.

I thought the "story point estimate" is origin create by Jira

because the issue type setting 


 截圖 2021-06-04 上午10.05.57.png

 

Then I find the "Story point estimate" is custom field 


MicrosoftTeams-image.png

 

You can find your customfield id by this tutorial : https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

 

And I set Additional fields to My project setting id

{
"fields": {
"customfield_10016": {{#=}}{{subtasks.customfield_10016.join(" + ")}}{{/}}

}
}

 

截圖 2021-06-04 上午10.09.51.png

 

It works. :)

Hi all!
Perhaps it helps to somebody else. I could sum up the estimates of all subtasks and set it as the estimation of the parent issue. This is the code:

{
"fields": {
"Story point estimate": {{#=}}{{subtasks.Story point estimate.join(" + ")}}{{/}}

}
}

 

Hey there, I thought I'd try your code as the last code I had in wasn't always reliable.  Or maybe it's the trigger itself. It doesn't always fire and sometimes the total is incorrect until I refresh the page. Any thoughts?

Hey @Mikaela Bertucci , I think that the total is always correct. The problem is what you mentioned: The UI doesn't update automatically after an event is fired, so you need to refresh manually. If sometimes it doesn't fire it could be because of a misconfiguration in your "when" and "if" conditions (they are not part of the code that I uploaded). Or maybe it always fires but you don't notice because you don't see any changes on the UI until the manual refresh.

It's not working for me either. It's giving me "Not valid JSON"

It works!

@John McKiernan Hey thanks for those tips! I'm trying to set up this subtask story point automation. I followed your instructions. The audit log tells me that everything worked successfully when I test it. However, the story point field does not get updated. Any ideas why this might be?

 

Screenshot 2020-04-14 at 15.57.05.pngScreenshot 2020-04-14 at 15.57.11.pngScreenshot 2020-04-14 at 15.57.21.pngScreenshot 2020-04-14 at 15.57.36.png

Hello @John McKiernan I have the same problem than @Stefanie Häuser , I am using Next gen project and trying to have "Story points of parent issue  = sum of the story points of child issue". My parent issue is a Story.

 

 Capture du 2020-04-16 12-28-42.png

I tested with {{childissues.Story points.join(" + ")}}  and {{subtasks.Story points.join(" + ")}}.

 

My audit log writes the changes as a success but my field "Story points" in the parent issue isn't updated .

 

Capture du 2020-04-16 12-30-25.png

 

Can you tell us what can be wrong in our rules ?

 

Thank you

I have the same problem :( 

Next Gen projects use "Story Point Estimates" not "Story Points"

@M_Y_ or anyone managed to get sum of standard issue story points into Epic Story Points? If so, please can you share your smart value details.

I also tried the same Smart Values: 

  • {{childissues.Story points.join(" + ")}}
  • {{subtasks.Story points.join(" + ")}}

and the log says success for both but story points aren't updated in the Epic.

Hi there, Im desperately trying to achieve the same thing here - sum up of story points to Epic level using automation.  Any further developments on it?

I am having the same issue. My rules run without any issues but can not see the story points on the stories. Looking forward for the solution.

I achieved an Epic roll up through a scripted field in Scriptrunner. I created a field called "Aggregate Story Points" and then used this code to get the results I was looking for.  Works really well.


import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
double totalSP = 0
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Story Points");
enableCache = {-> false}

issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->

double SP = (double)(issueLink.destinationObject.getCustomFieldValue(customField) ?: 0)
totalSP = SP + totalSP;
}
return totalSP as Long ?: 0L

In Jira Cloud - I could get the sum of story points of subtasks on the parent story successfully using Smart Value: {{issue.subtasks.Story Points.sum}}. But the only issue is when a sub task is deleted it doesn't recalculate the story points and update the parent story. Any suggestions

@Parvathy Manishanker davey

For this scenario I would run a scheduled rule at midnight that cleans up all the story points.  Take a look at this video and follow rule #3: https://www.youtube.com/watch?v=PROcxEOMyGM&t=13s

You would just needs to update the branches to do it on the Parent task.  

Regards,

Fabian

Hi Everyone,

Here is a link to a tutorial on how to sum up subtasks: https://www.youtube.com/watch?v=60sWD66l19k

The key smart value formula is: {{issue.subtasks.Story Points.sum}}

Regards.

Thanks Fabian.

I have written the smart value formula on Story point estimate instead of Story Points as we are using Story Point Estimate. If i go to the automation, I see that the automation is running correctly, it is editing the story, and I am also getting emails from Jira Automation showing the correct story points. However, I am not seeing it on the backlog.

Screen Shot 2021-06-25 at 10.36.57 AM.pngScreen Shot 2021-06-25 at 10.37.19 AM.png

 

 

Hi @Saket Gune

You may have to set the board to show Story Points Estimates instead of Story Points then. 

Here are the instructions on how to configure the board: https://support.atlassian.com/jira-software-cloud/docs/configure-estimation-and-tracking/

Hi Fabian,

Thanks. I went through the instructions but I can not see Board Settings I am the administrator for the project. I only see Configure Board. Here are my user settings.

Screen Shot 2021-06-25 at 11.47.31 AM.png

 

I also do not see Active Sprint Menu

Screen Shot 2021-06-25 at 11.49.23 AM.png

In your backlog, go to the top right corner:

board_settings.png

 

 

However, I recommend you stick with Story Points because once you start the sprint and complete it, you want to ensure that the reports are tracking the actual story points and not the Story Points estimate.  

Thanks, Fabian.

 

I can not see it. Is this feature available for a standard subscription? I am currently on a free subscription.

Fabian,

Thanks for all your help. I was able to figure it out. The reason I was not able to see the options is that I was using the incorrect Project type. I was using the team-managed project. I created the new company-managed project and it enabled me to see the screens you had mentioned in your response.

Does anyone know why I see two options for Story Points when i am creating the automation?

Screen Shot 2021-07-08 at 9.46.02 AM.png

That usually happens when you have two customfields with the same name.  Check your customfield in the sys admin configurations. 

Hey Guys,

 

I have one further issue - perhaps someone of you has a solution.

This rule of calculating Story Points of subtasks works perfectly for us als long as we don't have a 'Done' subtask in our story.
The goal is, Subtasks with Status = 'Done' shouldn't be included in the calculation. How can I add this condition into my automation? 

 

You can see my actual try in the screenshot. The result is, that as long as there is a subtask with the status = 'Done', it won't calculate anything (which makes sense in my opinion)

Bildschirmfoto 2020-05-15 um 17.30.52.png

 

Any ideas? :)

Uh? as a non techy person.. where is this code supposed to go?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

101 views 1 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you