Automation story point estimate - sum of story points of child items in parent field
Asked by Pedro Henrique Barreto Carvalho:

Hello,

I have a question.

I would like to create an automation that whenever I update the fields (story point) in the subtasks, the story point estimate field (story point field/Parent) is updated with the sum of the points informed in all the subtasks.  
I did the automation below, but the field is not being updated.

![image01.png](https://community.atlassian.com/t5/image/serverpage/image-id/195884i94E60AD76387E74D/image-size/large?v=v2&px=999 "image01.png")![image02.png](https://community.atlassian.com/t5/image/serverpage/image-id/195883i8264672A38B3308B/image-size/large?v=v2&px=999 "image02.png")![image03.png](https://community.atlassian.com/t5/image/serverpage/image-id/195885iB9CFED774A1CEAFE/image-size/large?v=v2&px=999 "image03.png")![image04.png](https://community.atlassian.com/t5/image/serverpage/image-id/195886i6B2EB7EA07EF45E8/image-size/large?v=v2&px=999 "image04.png")

thanks


Answers:
author: Bill Sheboy
body: Hi [@Pedro Henrique Barreto Carvalho](/t5/user/viewprofilepage/user-id/4887024)

Ignoring for a moment the practice of using story points with subtasks rather than just with stories...

Your *estimated points* field edit is on the Parent issue, but you are trying to:

* reference the trigger issue, which is a subtask, and
* using an invalid mathematical structure by adding to smart values without wrapping them with {{#=}} *your smart values* {{/}}

Instead you could just update the parent by summing the results each time in the branch with:

{{issue.subtasks.Story point estimate.sum\|0}}

Please note this will work for a team-managed project, which uses **Story point estimate** . If this is instead for a company-managed project, use **Story points**.

Kind regards,  
Bill

comments: author: Pedro Henrique Barreto Carvalho
body: Hello [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

thanks for the feedback. I have a project managed by the team. I tried to apply the code, but the field in the parent story(Sory point estimated) was not updated

![Captura de tela de 2022-05-05 12-02-26.png](https://community.atlassian.com/t5/image/serverpage/image-id/196056i6E8AE26EEEE94C1C/image-size/large?v=v2&px=999 "Captura de tela de 2022-05-05 12-02-26.png")![example.png](https://community.atlassian.com/t5/image/serverpage/image-id/196057i8D8D2B206177A8AE/image-size/large?v=v2&px=999 "example.png")


author: Bill Sheboy
body: For your smart value expression in the edit, it seems you changed the name. Perhaps try the exact built-in field name to see if that works.

{{issue.subtasks.Story point estimate.sum\|0}}

I wondered about that as your trigger also shows "Story point estimate" and not the one you typed in as "Story point estimado".


author: Pedro Henrique Barreto Carvalho
body: Thanks for the feedback. I received the points return by email, but the field: story estimated points was not updated.  
Do I need to do this update via code (more options)? Would you help me?


author: Bill Sheboy
body: You seem to be using a custom field named "estimated points", and so when you copy/paste that smart value expression into the edit value, it will appear below the field...then you may select it and it will be used.

If instead you want to update the parent issue's actual "Story point estimate" field, that can only be done with JSON under "more options".

Which do you want to do?


author: Pedro Henrique Barreto Carvalho
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

I would like to do it for Json. Can you help me?


author: Bill Sheboy
body: First, here is the documentation on using JSON for the edits and I encourage you to review it as it can help identify problems and provides how-to ideas: <https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/>

For updating **Story point estimate** in the parent for the sum of the children, please try:

```
{
  "fields": {
    "Story point estimate": "{{issue.subtasks.Story point estimate.sum|0}}"
  }
}
```


author: Pedro Henrique Barreto Carvalho
body: Thanks for support

I managed to solve it with the code below

{  
"update": {  
"Story Point estimate" : \[{  
"set": {{issue.subtasks.Story point estimate.sum\|0}}  
}\]  
}  
}


author: Reha Jhunjhunwala
body: I tried the same code for subtasks and it worked! Trying it for epics and the rule succeeds but i dont see a sum of the story point estimates. Using this --   

{  
"update": {  
"Story Point estimate" : \[{  
"set": {{issue.task.Story point estimate.sum\|0}}  
}\]  
}  
}


author: Bill Sheboy
body: Hi [@Reha Jhunjhunwala](/t5/user/viewprofilepage/user-id/5467653) -- Welcome to the Atlassian Community!

As this is a very old thread, I recommend you create a new question, perhaps linking back to this one. That will ensure the maximum number of people see it to offer suggestions. Thanks!

Kind regards,  
Bill