Sum up Story Points from Stories Under Epic (Jira automation)
Asked by Janany Satkunam:

I have looked at all the threads related to this issue but so far no workaround for the problem I am seeing. I have the automation set up as in the attached screen shot.

<https://www.youtube.com/watch?v=PROcxEOMyGM> is the video I was following. In the video it uses action **issuetype in (story) and "Epic Link" = "{{issue.Epic Name}}"** that didn't work so I changed it to**"parent" = {{issue.key}}**. However I still see the epic's Story Points field keep getting reset to zero.

Not sure why this is happening. Please help.

![SumUpStoryPoints-Issue.png](https://community.atlassian.com/t5/image/serverpage/image-id/318902i6AD4663BAD11E1AC/image-size/large?v=v2&px=999 "SumUpStoryPoints-Issue.png")


Answers:
author: Kalyan Sattaluri
body: Hello [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

Are your Epics and stories in the same project?

In your lookup JQL, use "Epic Link" = {{issue.Epic Link}}

Before you edit your issue, put a log statement and log the value {{lookupIssues.Story Points.sum}} to verify..

Parent logic is only for cloud.

comments: author: Janany Satkunam
body: Hi Kalyan, Epics and stories are in the same project. I tried "Epic Link" = {{issue.Epic Link}}. but the issue is still happening. Epic Story Points field resets to empty.

You mentioned putting a log statement. Can you give me the steps to do this? And what are we trying to check with this log statement?


author: Kalyan Sattaluri
body: Hello [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

Log statement just logs values so we know that lookupIssues found related stories of the epic or not. Its easy to understand whats going on looking at audit logs this way.

To do this, add component above "Edit Issue" -\> New Action - Type Log in search box, under Advanced, there will be "Log Action". (see screenshot 1).

Then when you have selected that option, put in {{lookupIssues.key}} and hit save. (see screenshot 2)

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/318940i354589890AD50A7B/image-size/large?v=v2&px=999 "image.png")

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/318941i68CBAE9311900901/image-size/large?v=v2&px=999 "image.png")

Now, going back to your issue, if Epic Link is not working, most probably your company has renamed the Epic Link to something else. Like "Feature Link". Try that.

If that also does not work, then,

* Log into Jira using your browser
* Pick a story (ABC-123) which has Epic (ABC-100) linked to it.
* Open a new tab in the Edge browser
* Put in below URL replacing the bolded parts and hit enter
* [https.**yourdomain** .net/rest/api/2/issue/**ABC-123**?expand=names](https://agile-jira-uat.wellsfargo.net/rest/api/2/issue/KPMS-340?expand=names)
* You should see a JSON response.
* Copy paste that JSON in a text editor like Notepad or Notepad++
* Search for ABC-100 (which is the Epic Key)
* Find the customefield which is assigned this value. (lets say its customfield_10080)
* Then thats what you will use in your lookupIssues, like "Epic Link" = {{issue.customfield_10080}}

Seems like a lot of the steps but this is wa way to find custom field values and once you do it, its straight forward. Bookmark that URL for future reference.

Please try and share if any issues. Thanks!


author: Janany Satkunam
body: I did the log statement as. you suggested. However I don't see any log entry in the ticket. Where should I see this logged?

As for doing the JSON, when I opened the URL with ?expand=names I am still getting the same normal view (not a JSON response).


author: Janany Satkunam
body: Also I can confirm we do use Epic Link which is cf\[10008\]. But one thing I don't understand is why the Epic's Story Points value get set to zero. For example, I just updated to a random number and then I went and updated the child story's 'Story Points' field. As soon as I did that, the parent's story points field got set to nothing.

See attached screenshot from the history tab of the epic.![Screenshot 2024-04-17 at 12.26.45?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/318959iBD8E9B6DE4A257F8/image-size/large?v=v2&px=999 "Screenshot 2024-04-17 at 12.26.45?PM.png")


author: Kalyan Sattaluri
body: My hunch is that you have a separate rule which is wiping this field every time it gets updated. Please review your existing rules.


author: Janany Satkunam
body: That's not possible because this is my first rule I am trying out.


author: Kalyan Sattaluri
body: [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

OK, I just tested. Because you are in Data Center edition, Story Points is not exposed when using lookupIssues. There a limited set of fields we can use this way. Cloud OTOH exposes all fields but unfortunately DC has this limitation.

Your only option is to make a web request call to sum up the story points. If interested in that route, we can discuss next steps.


author: Janany Satkunam
body: HI Kalyan,

I see the below in audit log. Is this because of the reason you are explaining above?

I do want a solution to achieve my desired output. Please advise on next steps.

![Screenshot 2024-04-17 at 4.59.18?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/319039i8306F2AE150DA606/image-size/large?v=v2&px=999 "Screenshot 2024-04-17 at 4.59.18?PM.png")


author: Kalyan Sattaluri
body: [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

Never mind, I had a typo earlier when I was testing. We can do this simply.

Please make your rule just like I have below and share audit log screenshot if issues.

Thanks!

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/319043iC96BA5E4451F74A4/image-size/large?v=v2&px=999 "image.png")


author: Bill Sheboy
body: FYI, here is the suggestion to add those other fields to Lookup Issues for the Data Center version of automation: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-877>

If it is of any consolation, when Lookup Issues was added for Jira Cloud, it also only had about a dozen fields. About a year later, all of the remaining fields were added.


author: Janany Satkunam
body: [@Kalyan Sattaluri](/t5/user/viewprofilepage/user-id/5312306) I can't see what you have for the last condition (for the then statement for Edit Issue). Can you also share that?   
Also are you saying that this should work for DataCenter version? I thought there was some limitation you mentioned in previous reply.


author: Kalyan Sattaluri
body: [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

What you have for the edit issue should work. that is assign it the {{lookupIssues.Story Points.sum}}

Also, ignore what I said earlier. I had a typo and was mistaken.

Please implement like I have in my screenshot, trigger the rule by changing a story's points and check epic field and share audit log if it does not work.


author: Janany Satkunam
body: Still getting set to zero. See the audit log below:

![Screenshot 2024-04-18 at 6.20.52?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/319149i580ED745C83A04D2/image-size/large?v=v2&px=999 "Screenshot 2024-04-18 at 6.20.52?AM.png")


author: Janany Satkunam
body: Hi Kalyan, I got it to work!

There are two fields called "Epic Link" and it was using the wrong one. So I changed the LookUp JQL to cf\[10008\] = {{issue.Epic Link}}. and it started working.

![Screenshot 2024-04-18 at 6.47.07?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/319158i42561758D2F5B5DA/image-size/large?v=v2&px=999 "Screenshot 2024-04-18 at 6.47.07?AM.png")


author: Kalyan Sattaluri
body: Great, please accept answer so it helps others in the future thanks


author: Janany Satkunam
body: Right now the rule is only triggering on create or edit actions. I want the story points field of the epic updated anytime epic link is updated to this epic or if a child is deleted or moved. Can I accomplish all of this in one action?

comments: author: Kalyan Sattaluri
body: You can just use "Multiple Issue Events" trigger and choose Issue created, Issue Deleted, Issue updated triggers together and update epic. It should cover all your scenarios. Do note that for for issue created scenario, you need to include an additional Re fetch action because usually the rule does not have all the fields at hand when issue created is the trigger. You could separate that out as a rule by itself and rest, combine them in 1 rule. Hope it helps and as mentioned in below, please accept that answer for future reference. Thanks!


author: Janany Satkunam
body: I accepted the answer for the original issue.

Can you let me know how use "Multiple Issue Events" for the rule I have? Also how do I delete a component on the automation rule as currently I don't see an option to do this.


author: Kalyan Sattaluri
body: Right now you have field value changed, instead you will choose "multiple issue events" trigger as below.. My suggestion is, keep "Issue created, Issue updated" together and Issue deleted a separate rule.. And add a refetch action step after trigger..

Also, I am not sure what do you mean delete component... As in remove component from issue?

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/319212iE22CDF2110837522/image-size/large?v=v2&px=999 "image.png")


author: Janany Satkunam
body: I mean when I am setting up the rule and say I added a condition or action which I now want to remove. How do I go about doing that on the automation screen. Even right now, if I want to change the 'field value changed to 'multiple issue events' how do I do that? I don't see an obvious way.


author: Kalyan Sattaluri
body: You just hover over the name of the component, see highlighted, you can edit trigger or delete components from there.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/319240iC8F68794085E0EAF/image-size/large?v=v2&px=999 "image.png")


author: Janany Satkunam
body: That is super helpful. Thank you! Does the below look right?

![Screenshot 2024-04-18 at 10.37.31?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/319262i48B28CACADDC401F/image-size/large?v=v2&px=999 "Screenshot 2024-04-18 at 10.37.31?AM.png")


author: Kalyan Sattaluri
body: I dont have access to delete issues in my instance so I dont know if re fetch will work for that scenario.. but even if that step errors out, epic will still be updated. Thats why I said to separate Issue deleted as its own rule. You can simply go back to your rule list and copy current one and modify the trigger so it should not be a lot of work,

Finally, one last addition, before refetch, include an if condition, issue type check and check if issue is a story/task, only then continue with refetch and other steps, cause this rule as it is now will run for changes made to sub-task/epic etc which you dont want...

If you make that change, everything looks good. Try it and share if issues.


author: Bill Sheboy
body: Hi [@Janany Satkunam](/t5/user/viewprofilepage/user-id/5477627)

Are you using Jira Cloud? And if so, are you using a company-managed or a team-managed project? You may find that information and the bottom-left of the screen expanding area on the page.

Company-managed projects use the "Story points" field and team-managed projects use the "Story point estimate" field...even though the UX typically calls them the same. For the smart values, the two options would be:

{{lookupIssues.Story points.sum\|0}} or {{lookupIssues.Story point estimate.sum\|0}}

I added a default value of 0 to the end after the sum.

Kind regards,  
Bill

comments: author: Janany Satkunam
body: This is a DataCenter version.


Tags: epic

story-points