I need to update the story point of an "Initiative" as the sum of the "linked" epics
Asked by Apoorva Pahuja:

I need to update the story point of an "Initiative" as the sum of the "linked" epics. So epics are linked to the initiative (not as a subtask but as a link). Whenever the story point of the epics change, the change should get reflected in the way that the sum of story points of all the linked epics should be = story point of the initiative

1. When: the value of story points changes

2. If the issue type is epic and there are linked issues

3. For the linked issues (which means the for initiative}

Story point = {{issue.issuelinks.Story Point.sum}}

However, this is not working. The story point for the initiative is zero even when the story point for epic has values

This is similar to what was done here

<https://www.atlassian.com/software/jira/automation-template-library/sum-up-story-points>

Please help, urgent!


Answers:
author: Apoorva Pahuja
body: Thanks, so finally these rules worked.

Now I am able to sum subtasks to 1. user stories/task level, then another rule to go from 2. user story to epic level and then one from 3. epic to initiative (linked, not through hierarchy)

These rules are working very well individually, but are not working together, so when #1 runs, the #2 doesn't get triggered automatically even if story points are getting changed at a story level. But when I manually change the story points of the user story, the #2 works.

Ideally since the trigger is change of story points, the rules should run whether the change is done manually or by another automation rule . Could you please help?


author: Jordan Richter
body: This works for me.![Story points from Epics to Initiative.png](https://community.atlassian.com/t5/image/serverpage/image-id/286820i3CF2F95DF01E6E86/image-size/large?v=v2&px=999 "Story points from Epics to Initiative.png")  

<br />


author: Eli Solutions Team -Eli Solutions-
body: For those who are interested. We created a video tutorial here: <https://community.atlassian.com/t5/Automation-articles/Jira-Automation-Sum-Up-Story-Points-from-Epics-e-g-Initiative-gt/ba-p/1926311>

Regards


author: Apoorva Pahuja
body: There are no errors, the rule is successful, but the sum is not happening, the story point value is 0

See rule below:  
![Snapshot.png](https://community.atlassian.com/t5/image/serverpage/image-id/171376i2C35C29E60FC3C86/image-size/large?v=v2&px=999 "Snapshot.png")


author: Curt Holley
body: Are you talking about "parent link" (I.E. the epics that are children of the initiative) or just standard JIRA "linked issues"?  
As, using the "Parent link" field with an Advanced Roadmap plan and Story points "rolled-up" feature enabled means you can get the affect of "summing", without the need to automate at all.  
See below "Roll-up" checkbox to tick and Story points column with "rolled-up" story points from the children (*denoted by the up arrow)*

![Screenshot 2021-11-30 104648.png](https://community.atlassian.com/t5/image/serverpage/image-id/171302iD572235CA3CB0F8D/image-size/large?v=v2&px=999 "Screenshot 2021-11-30 104648.png")

comments: author: Apoorva Pahuja
body: I am using the general links.


author: Curt Holley
body: In that case I have to wonder if it would make may sense to change tack and make children of the Initiative??

If these Epics are so crucial to this initiative that you want to derive its Story point total, then surely they should be hierarchically linked (using the Parent link field).   
This would be playing to Jira's strengths and would enable not only the story point summing you desire, but also better, more logical and easier to create and maintain views in Advanced roadmaps. *It would also make writing your automation rule easier.*

May I also ask, if these Epics are not the children of the Initiative, then which ones are? and how do they differ to these ones? Why would they not all be part of the Initiatives hierarchy?


author: Bill Sheboy
body: Hi [@Apoorva Pahuja](/t5/user/viewprofilepage/user-id/4653428) -- Welcome to the Atlassian Community!

Please post images of your complete rule and the audit log show details where the rule does not work as you expect. That may provide context for what is happening. Thanks!

In the mean time, consider adding some log statements in your rule to confirm the values you are trying to sum/set are what you expect.

Kind regards,  
Bill

comments: author: Bill Sheboy
body: Thanks for the image of your rule. I believe that {{issue.issuelinks}} only contains the keys and not the rest of the data (such as story points). You could confirm this by writing the following to the log in that branch to learn if any values are shown:

{{#issue.issuelinks}} {{Story points}} {{/}}

And even if that did work, your branch's scope would be updating the story points of the epics. You would then need to accumulate the values for the epics to store a total in the initiative.


author: Apoorva Pahuja
body: Thanks, How should I do the sum ?  
{{#issue.issuelinks}} {{Story points}} {{/}.sum} ?  

Similarly, what is the smart value to point the stories linked to epic as epic links.. for example for epic (parent), the story point = sum of story points of all the linked stories?


author: Bill Sheboy
body: First, I was suggesting to try logging the values without summation. That will confirm if the values are even present. If so, then investigate why they are not summing. If not, you will need another way to access them, such as a branch on JQL.

Next, the connection between epics and child issues depends upon your project type: company-managed or team-managed.

* For company-managed, that is epic link
* For team-managed, that is parent

In either case, if you are using branches the automation rule handles this for you. If instead you are branching on JQL, use the appropriate connection field, epic link or parent. For example if the trigger issue is an epic, to find its children with JQL would be:

"Epic Link" = {{triggerIssue.key}}


author: Apoorva Pahuja
body: {{#issue.issuelinks}} {{Story points}} {{/}} is not working. There are no errors but the story point field is updated to "None" instead of the actual value  

<br />


author: Bill Sheboy
body: Thanks for that information. That means the issue links only contain the keys, as I suggested. To sum up the story points for linked issues you may to use another method, such as Lookup Issues with JQL on the list of issue link keys:

```
key IN ( {{#issue.issuelinks}} {{key}} {{^last}} , {{/}} {{/}} )
```

With that for the lookup's JQL, you may get the sum from:

```
{{lookupIssues.Story points.sum}}
```


author: Apoorva Pahuja
body: Thanks, so finally these rules worked.

Now I am able to sum subtasks to 1. user stories/task level, then another rule to go from 2. user story to epic level and then one from 3. epic to initiative (linked, not through hierarchy)

These rules are working very well individually, but are not working together, so when #1 runs, the #2 doesn't get triggered automatically even if story points are getting changed at a story level. But when I manually change the story points of the user story, the #2 works.

Ideally, since the trigger is change of story points, the rules should run whether the change is done manually or by another automation rule . Could you please help?


author: Apoorva Pahuja
body: All the rules are attached![Epics to initiatives.png](https://community.atlassian.com/t5/image/serverpage/image-id/172161i6784EFE5A8F34F40/image-size/large?v=v2&px=999 "Epics to initiatives.png")![Stories to epics.png](https://community.atlassian.com/t5/image/serverpage/image-id/172160i279673FB73773C7D/image-size/large?v=v2&px=999 "Stories to epics.png")![Subtasks to Stories.png](https://community.atlassian.com/t5/image/serverpage/image-id/172159i640EC57DB0D5F00D/image-size/large?v=v2&px=999 "Subtasks to Stories.png")


author: Apoorva Pahuja
body: Just to also clarify, when i run the subtasks rule, the #2 and #3 rule logs say that only the user story points of the subtask has changed, it doesn't even take into account the story point change for the user story using the automation rule when #1 runs


author: Bill Sheboy
body: Hi [@Apoorva Pahuja](/t5/user/viewprofilepage/user-id/4653428)

When your use case requires a change made by rule #1 to trigger another rule (e.g. rule #2), look in the details section of rule #2 and enable "Allow Rule Trigger". This is disabled by default to prevent a looping/runaway situation in rule execution.

After enabling this option, keep a close watch on the rule for a while to ensure it is not looping or using up your instance usage limits for automation.


author: Apoorva Pahuja
body: Thanks, its working