How do you sum up story points to the epic using jira automation?
Asked by Neil Wills:

How do you sum up story points to the epic using jira automation?

Is there a consequence to summing up the story points to the epic level and updating the epic story points field value?


Answers:
author: Bill Sheboy
body: Hi [@Neil Wills](/t5/user/viewprofilepage/user-id/4327689) -- Welcome to the Atlassian Community!

You can do that easily with the [Lookup Issues actio](https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/#Smartvaluesgeneral---lookupIssues--)n, using JQL to find the issues with your epic's key in their "epic link" field. There is an example of that summation in the doc link I provided.

Regarding consequences of changing the epic's field, there may not be any. Epics normally do not have story points and so I do not believe they are used in any built-in reports.

Best regards,

Bill

comments: author: Neil Wills
body: I noticed that I will have to be careful, if I sum up the points from stories to epics, and I include the epic in the sprint then it will affect the burndown and velocity reports,

I think as a team we will be keeping epics out of the sprint when they contain a number of stories and they are pointed.


author: Neil Wills
body: Looking at the Epic history, I am resetting Story Points to None

I tried using:

    {{lookupIssues.Story Points.sum}}


author: Neil Wills
body: ![screenshotofruledefinition.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/150244i98B7858EB700D084/image-size/large?v=v2&px=999 "screenshotofruledefinition.JPG")


author: Bill Sheboy
body: Hi [@Neil Wills](/t5/user/viewprofilepage/user-id/4327689)

Looking at your draft rule, I think you are missing some pieces to make this complete. If your use case is "when the story points change for a story, update the parent to contain the sum for its children", consider this example rule:

* trigger: field changes for story points
* condition: issue type is not epic
* condition: epic link is not empty
* action: lookup issues on JQL where "epic link" = {{triggerIssue.epic link}}
* branch: on epic parent
  * edit issue fields: setting the story points to {{lookupIssues.Story Points.sum}}

Of note: this works for a company-managed (classic) project. If you are using a team-managed (next-gen) project, then:

* substitute "parent" for "epic link"
* substitute "Story Point estimate" for "Story Points"


author: Neil Wills
body: To confirm, this is a company manage project


author: Neil Wills
body: I see that Epic Name is available, the field Epic Link is not listed in the dropdown


author: Bill Sheboy
body: Hi! To which dropdown are you referring?


author: Neil Wills
body: Progress ![screenshotofruledefinition3.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/150254iE96FB592A4E68A21/image-size/large?v=v2&px=999 "screenshotofruledefinition3.JPG")


author: Neil Wills
body: ![screenshotofruledefinition4.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/150255iB7DB5FC72AC87A35/image-size/large?v=v2&px=999 "screenshotofruledefinition4.JPG")


author: Neil Wills
body: I thought that the 'Issue fields condition' would have provided a field Epic Link, I used a SQL statement instead


author: Bill Sheboy
body: Did that then work for you? If so, please consider marking this question as answered to help others find solutions faster. Thank you!


author: Neil Wills
body: This was my initial state, it would seem that this approach did not succeed in retrieving the stories related to the epic for the story was modified. If you read above you will see that solved my use case with Bill's assistance using a difference approach. Thank you

![ruledef-didnotwork.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/150271i05E0CD3E78F16B40/image-size/large?v=v2&px=999 "ruledef-didnotwork.JPG")![ruledef-didnotwork2.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/150272iB75D5AD84DBEEE12/image-size/large?v=v2&px=999 "ruledef-didnotwork2.JPG")


author: Neil Wills
body: I found my answer using a different approach, would still like to understand why my original approach did not work

[How do you sum up story points to the epic using j... (atlassian.com)](https://community.atlassian.com/t5/Automation-questions/How-do-you-sum-up-story-points-to-the-epic-using-jira-automation/qaq-p/1731595?utm_campaign=&utm_content=post&utm_medium=email&utm_source=atlcomm)


author: Bill Sheboy
body: Hi, Neil. Looking at your original rule, it appears you were missing the action to Lookup Issues with JQL before the Branch... That loads up the children of the epic, and then allows the ...sum to work for story points.


author: Jon Zacharias
body: [@Neil Wills](/t5/user/viewprofilepage/user-id/4327689) [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) any suggestions on troubleshooting this function?  

Automation appears to be set up correctly, audit log is registering successful events, but Story Points field is not being updated on the Epic.

Any ideas?

![2022-01-24_15-24-59.png](https://community.atlassian.com/t5/image/serverpage/image-id/179545iC9B4B30EB911295A/image-size/large?v=v2&px=999 "2022-01-24_15-24-59.png")![2022-01-24_15-25-55.png](https://community.atlassian.com/t5/image/serverpage/image-id/179546i9CE9CCB98DA52046/image-size/large?v=v2&px=999 "2022-01-24_15-25-55.png")

comments: author: Bill Sheboy
body: Hi [@Jon Zacharias](/t5/user/viewprofilepage/user-id/4333232)

You appear to be matching on Epic Name, and not epic key for the match. Please try changing your lookup issues JQL in the branch to:

```
project = {{triggerIssue.project.key}}
 AND issueType IN ("story", "Change Request", "Improvement")
 AND "Epic Link" = {{issue.key}}
```

Also, what is the value you are using in the edit?

Kind regards,  
Bill


author: Jon Zacharias
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) I am in a CMP

And it looks like adding that {\[triggerIssue.project}\] worked!! How odd since I was seeing the audit log be successful..

The value I am using in the edit is when Story Points changes for Create Issue, Edit Issue


author: Bill Sheboy
body: That is good to learn.

And I hope you caught my typo (wrong bracket type) in that smart value as it should have been:

```
{{triggerIssue.project.key}}
```

I will fix the post in case others use it.


author: Jon Zacharias
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) now this is not working again after I tried to clean up my JQL query to match yours?

Do you see anything that I messed up? This is the audit log message

![pic1.png](https://community.atlassian.com/t5/image/serverpage/image-id/179563iC13ECC3E551F2DDD/image-size/large?v=v2&px=999 "pic1.png")![pic2.png](https://community.atlassian.com/t5/image/serverpage/image-id/179562i5D95B739803BDEB1/image-size/large?v=v2&px=999 "pic2.png")


author: Bill Sheboy
body: Oops...my bad!

{{triggerIssue.project}} is an object, and you only need the key. Please update the JQL to use:

{{triggerIssue.project.key}}


author: Jon Zacharias
body: You are the man! We are SO close :)

Audit log looks good. Query is updated. Everything is looking good....except the Story Points field isn't actually getting updated!....

Any silver bullets for this last issue?

![pic3.png](https://community.atlassian.com/t5/image/serverpage/image-id/179572iC2A78F50D4541A7C/image-size/large?v=v2&px=999 "pic3.png")![pic4.png](https://community.atlassian.com/t5/image/serverpage/image-id/179571i4ADC35A89CD3CEB8/image-size/large?v=v2&px=999 "pic4.png")


author: Bill Sheboy
body: Would you please show what you are using for the edit value? For example, to sum the values from a lookup issues I would use:

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

The \|0 at the end handles the edge case of all of the values are empty (null), so return a zero.


author: Jon Zacharias
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) I believe I figured it out

I was using {{lookupIssue.Story points.sum}}

I updated it to {{lookupIssues.Story points.sum}}, and it seems to be working


author: Stuart Nealis
body: Thank you to both [@Jon Zacharias](/t5/user/viewprofilepage/user-id/4333232) and [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) for this detailed troubleshooting, it helped me implement this without issue. Cheers guys!


author: Neil Wills
body: Let me know if you run into continued issues


author: Finnlay Morcombe
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)   

I have tried replicating the above to no avail. It runs successfully but doesn't update the epic. We are in a team-managed project. The only thing i can think of that would make it not work is the **And: Edit issue fields** has no direct option for Story point estimate, although I updated the JQL to reflect.

![JQLAutomation.png](https://community.atlassian.com/t5/image/serverpage/image-id/299215i7E1BFB718ADD915A/image-size/large?v=v2&px=999 "JQLAutomation.png") Here is my Edit issue3 JQL: {{lookupIssues.Story point estimate.sum\|0}}


author: Bill Sheboy
body: Hi [@Finnlay Morcombe](/t5/user/viewprofilepage/user-id/5399644) -- Welcome to the Atlassian Community!

First thing: this is an older thread and so only those following it will see your question. I recommend creating a new question and linking back to older threads. That will ensure a larger audience sees it to offer suggestions. Thanks!

Next, your rule is using several conditions in a row to test the issue type, and so that will halt when the first one does not match. Did you instead want to use a single condition on "issue type is Task, Subtask, Bug, or Story"?

Next, even with that change, there is a problem: I see a condition on Subtask issue type, but story points are normally only assigned at the issue level (i.e., Story, Task, Bug, etc.) and not at a Subtask level. To what types is your team assigning story points?

Finally, team-managed projects use the *parent* field (not Epic Link) to associate Epics and child issues. (Company-managed projects have mostly changed to that also.) But your Lookup Issues action's JQL is referencing Epic Link. Please try using *parent* instead, and I recommend creating and testing your JQL with an issue search outside of the rule first.

Kind regards,  
Bill


author: Alfredo Maria FIAMMELLA
body: Hi,

is there any chance to use a custom field into *{{lookupIssues. **custom field** .sum\|0}}* instead of using *{{lookupIssues.Story points.sum\|0}}*

thanks

comments: author: Stuart Nealis
body: Hi [@Alfredo Maria FIAMMELLA](/t5/user/viewprofilepage/user-id/5589873) , I did just that a month ago as we transitioned away from story points and now use a few hours fields for planning. I replaced the Story points with the custom field name and it now sums Total Hours on epics for us.

![custom field summation on epic.png](https://community.atlassian.com/t5/image/serverpage/image-id/346865i8B3C0F95405E8866/image-size/large?v=v2&px=999 "custom field summation on epic.png")


author: Bill Sheboy
body: Hi [@Alfredo Maria FIAMMELLA](/t5/user/viewprofilepage/user-id/5589873) -- Welcome to the Atlassian Community!

The answer depends on which version of Jira (and automation) you are using:

For Jira Cloud, custom fields are available to the Lookup Issues action. Specifically, the action supports all the issue fields available to the REST API endpoint for issue get.

For Jira Server / Data Center, custom fields are not yet available to the Lookup Issues action. Here is the suggestion to add the other fields: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-877>

The workarounds for Server / Data Center depend on how you want to use the custom fields...

* If you only want to sum the fields and do something like send an email, the bulk-handling feature of branches / scheduled triggers with the plural {{issues}} smart value may be used: <https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html> All of the fields are available to the {{issues}} smart value, and that may be used in place of {{lookupIssues}}
* If your rule wants to edit an issue with the sum value (or the rule already uses branching) you may instead call the issue search with JQL, REST API endpoint using the Send Web Request action. Then the {{webhookResponse}} is used.

Kind regards,  
Bill


author: Alfredo Maria FIAMMELLA
body: Thanks both for the quick responses.

* I'm using Jira Server 9.12 --\> this explains why it is not possible to add the custom field according to Bill answer
* My rule is just to edit the epic issue whenever a user story estimation is modified.

I would like to know more about your suggestion of *calling the issue search with JQL, REST API endpoint using the Send Web Request action. Then the {{webhookResponse}} is used.*

Where can I find more details about it ?

thanks


author: Bill Sheboy
body: Thanks for confirming your Jira version. Here is an answer from a similar question describing what is needed for the field by calling the REST API:

<https://community.atlassian.com/t5/Jira-questions/Re-How-to-sum-story-custom-filed-values-to-an-epic/qaq-p/2787339/comment-id/1043853#M1043853>

Please review the linked how-to articles which describe confirming your field smart value / custom field id, and step-by-step calling of the endpoint from a rule with Send Web Request.

If you run into challenges, please post images of your complete rule and the audit log details for context. Thanks!


author: Bijal Patel
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)

I am facing the same issue as the other guys. The Audit log status = success, it says that it successfully updated the Epic Story points field but it reality its NOT summing up - it is actually updated the story point to 0.

Attached are the pictures for your reference, please advice, thank you.

![SP 2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/269967iFBA779651BCFF396/image-size/large?v=v2&px=999 "SP 2.PNG")![SP 1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/269968i8B2790D16882EE89/image-size/large?v=v2&px=999 "SP 1.PNG")![SP 3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/269969iBE664BDF89718174/image-size/large?v=v2&px=999 "SP 3.PNG")

comments: author: Bill Sheboy
body: In the JQL for your Look Issues action, please try matching an Epic Link to a key, and not the name:

issueType IN (Story) AND "Epic Link" = {{triggerIssue.Epic Link}}

or

issueType IN (Story) AND "Epic Link" = {{issue.key}}

The second one should work inside of the branch as at that point, {{issue}} refers to the branched-to issue: the epic.


author: Bijal Patel
body: Unfortunately it does the same thing for both the options. Existing story points changes to 0 .

And no errors in the Audit log - status=success, just like before.

I have tried so many variation but this automation cant seem to work.


author: Bill Sheboy
body: Are you using a company-managed project or a team-managed one? You may find this information at the bottom-left of the page's expand area.

* Company-managed projects use the smart value "Story points" but
* Team-managed use "Story point estimate"...
* even though they are both called "Story Points" in the UI.

If you need to change your rule, please note the spacing and capitalization; both are important for rules to work correctly.


author: Stuart Nealis
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) , this was working for me perfectly for a year, but now seems to work only intermittently. I am unable to get epics to update story point values when child issues change their story points, despite that working just fine historically. Any idea what might have changed?

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

comments: author: Bill Sheboy
body: Hi [@Stuart Nealis](/t5/user/viewprofilepage/user-id/4488980)

Would you please post an image of the audit log details showing the rule execution? That may provide more clues / context for this. Thanks!

I know the changes for the epic fields rolled out this year, and so a likely adjustment will be using the *parent* rather than the *epic link* field. Let's see the log first to confirm where the problem is happening.

Kind regards,  
Bill


author: Stuart Nealis
body: ![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/269949i810545C7C67F4B07/image-size/large?v=v2&px=999 "image.png")

Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) , Epic link was my suspicion as well, but what is odd is the audit log shows it completed successfully. The story point total does not change, however, and the epic history shows no updates.


author: Bill Sheboy
body: Let's rule out (no pun intended :\^) some things...

Is this a company-managed or team-managed project? (Remember that team-managed use the "Story point estimate" field rather than the "Story points" field.

If you navigate to that epic, can you see the story points field?

If you manually edit the story points field for the epic, what do you observe happening?

Has the owner of the rule changed recently?

Have the permissions of the Automation for Jira user changed recently?


author: Stuart Nealis
body: * It is a company-managed project
* story points field is visible on the epic
* manually editing the field is successful, it stays updated with whatever value you add
* the rule has not changed owners
* permissions have not changed for Automation for Jira user.

I should point out that I created this automation as a copy of an existing one that triggers off story point value changing on any non-epic issue, I just made this version manual trigger because I noticed a few epics hadn't summed child story points correctly. The original version is running successfully, even this morning, but I am unable to get either version to work on those problem epics. The inconsistency is the issue, as I'm not sure the data are reliable at the epic level now.


author: Bill Sheboy
body: I wonder if the smart value is not matching in the JQL for some reason...

Let's try this: immediately after the lookup issues action (and before the branch), please write the following to the audit log and observe what you see:

```
lower case epic link: {{triggerIssue.epic link}};
mixed case epic link: {{triggerIssue.Epic link}};
upper case epic link: {{triggerIssue.Epic Link}};
parent key of trigger: {{triggerIssue.parent.key}};
lookup count: {{lookupIssues.size|0}};
story points sum: {{lookupIssues.Story points.sum|0}};
```


author: Stuart Nealis
body: Interesting, it seemed to work this time when triggered, as it did sum story points to the epic, however it didn't arrive at the correct total (should have been higher than 25)![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/270819iEE058A7F9DD3ACB8/image-size/large?v=v2&px=999 "image.png")


author: Reysla Chiaradia
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313), thanks for your solution. It worked for me. I need to track only the story points delivered within an epic and set this in another custom field to report project costs. I tried many ways to sum up story points for the issues with "status = Done", but I didn't succeed in any attempt I made. Can you help me out, please?

comments: author: Bill Sheboy
body: Hi [@Reysla Chiaradia](/t5/user/viewprofilepage/user-id/5216347) -- Welcome to the Atlassian Community!

First thing, are you using Jira Cloud or Jira Server/Data Center? That will impact which rule features are available for you. Let's assume you are using Jira Cloud for the moment, and that you are using the Lookup Issues action to gather the child issues of the epic...

You could either modify the JQL for the lookup to include your done status (as you described), or you could use math functions and smart value, list filtering.

If you have tried both of those and they did not work, please post images of your complete rule and the audit log details. Those will provide context for the community to help. Thanks!

Kind regards,  
Bill


author: David Peles
body: Hi [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) , thanks for all the support and help bringing reliable value to the community .  

looks that I need some assistance with what I understand to be. your solution. (I am quite new with Smart Values)   

I am trying to get the Epic's childrens (stories) story points to their Epic.  

what i am doing wrong ??

![Screenshot 2023-08-16 at 16.10.28.png](https://community.atlassian.com/t5/image/serverpage/image-id/275483i3258E18089866601/image-size/large?v=v2&px=999 "Screenshot 2023-08-16 at 16.10.28.png")


author: Bill Sheboy
body: Hi [@David Peles](/t5/user/viewprofilepage/user-id/5291901) -- Welcome to the Atlassian Community!

In the JQL for your Lookup Issues, you are comparing the "Epic Link" to a name, rather than the key. Please try substituting to compare to {{issue.key}}

And, please note you have a stray quotation mark in that JQL...but that should be unnecessary if you make the change I suggested.

Kind regards,  
Bill


author: Ron McFarlane
body: Unfortunately, this is not working for me and I cannot work out why. The story gets updated with story points and the rule triggers, it successfully looks up the other stories in the Epic and the rule appears to update the epic (PMP1-17). For some reason, the story points on the epic is not being updated. Your guidance would be appreciated. It is a company managed project

![Screenshot 2022-09-16 173555.png](https://community.atlassian.com/t5/image/serverpage/image-id/216329iBD9CC7B6632F7768/image-size/large?v=v2&px=999 "Screenshot 2022-09-16 173555.png")![Screenshot 2022-09-16 173521.png](https://community.atlassian.com/t5/image/serverpage/image-id/216330iA0BE8A8D5F37EE02/image-size/large?v=v2&px=999 "Screenshot 2022-09-16 173521.png")

comments: author: Bill Sheboy
body: Hi [@Ron McFarlane](/t5/user/viewprofilepage/user-id/4619207)

Smart values are name, spacing, and case-sensitive. Please try this instead for your edit:

{{lookupIssues.Story points.sum\|0}}

When in doubt for what to use for a smart value, please take a look at this how-to article. It shows how to load an issue and see all possible smart values.

<https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/>

Also note I stuck a default value of zero on the expression. This will handle the case of all of the story points being empty (null).

Kind regards,  
Bill


author: Henrik Ekenberg
body: Hi,

I try to do this on my Jira.

But I get no values for story point in my EPIC ( Well I get 0 )

Both Story have values for Story point

Change value is "{{lookupIssues.Story points.sum\|0}}"

What do I miss ?

//Henrik

![jira2.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/252077iF46C2A6F4E14FED6/image-size/large?v=v2&px=999 "jira2.PNG")![jira1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/252075iBBF77332281F4ECA/image-size/large?v=v2&px=999 "jira1.PNG")


author: Bill Sheboy
body: Hi [@Henrik Ekenberg](/t5/user/viewprofilepage/user-id/5197013) -- Welcome to the Atlassian Community!

To use the {{lookupIssues}} smart value you must first use the Lookup Issues action to populate the results. Please look earlier in this thread, or at the documentation, for how to do that.

Kind regards,  
Bill


author: Henrik Ekenberg
body: Hi,

Before post last message tested this but without success.

Maybe wrong way get lookupIssues ?

//H

![jira3.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/252112i7F41F9F275EE829D/image-size/large?v=v2&px=999 "jira3.PNG")


author: Bill Sheboy
body: Hi [@Henrik Ekenberg](/t5/user/viewprofilepage/user-id/5197013)

Are you using Jira Cloud or Jira Server/Data Center version? My understanding is the Lookup Issues Action is only supported by Jira Cloud currently.

Thanks!


author: Henrik Ekenberg
body: Hi,

I use Server / Data Center version.

So no work around ?

//H


author: Bill Sheboy
body: For the Server/Data Center version of rules, there is a **bulk-handling option** to treat the results of a branch or scheduled trigger as a set, and this enables the {{issues}} smart value. Note this one is plural, and it is the equivalent of Lookup Issues for Cloud...although it is a bit less flexible. Perhaps try that to see if it helps.


author: Joshua Yu
body: [![Screen Shot 2022-06-08 at 9.57.59 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/201175i2352EB61C459C36C/image-size/large?v=v2&px=999 "Screen Shot 2022-06-08 at 9.57.59 PM.png")](https://files.slack.com/files-pri/TR2BPLCTG-F03JFR59Q5D/image.png)

This is the configuration I came up with for team managed projects. hope it helps someone.

comments: author: scott-altman
body: Whats in your Then: Edit Issues fields Advanced section?


author: Fernando Cirino Sato
body: Hi, it seems lookupIssues option is not avaiable for Jira Server. Any WA to make it work on Jira Server version?

comments: author: Bill Sheboy
body: Hi [@Fernando Cirino Sato](/t5/user/viewprofilepage/user-id/4823586) -- Welcome to the Atlassian Community!

For Server/Data Center version, please take a look at bulk-handling option for branches and scheduled triggers. That allows you to use the {{issues}} smart value to treat them as a set.

<https://confluence.atlassian.com/automation/bulk-handling-of-issues-993924653.html>

Kind regards,  
Bill


author: Neil Wills
body: I have moved away from this, removing epic story points sum up.

Why?

I have moved to using Jira advanced roadmaps and let the roll up happen naturally.

If we move engineering to tasks under stories then I would have to use the original answer which is to sum up tasks to stories.


author: Maria DePasquale
body: Has anyone been able to make this work for Jira Server or Jira Data Center? Seems easy for Jira Cloud. After pouring through all the posted links for additional information, I can't seem to make this work. The best I can do is get the Summed Story points to show 0 on the Epic, which means it doesn't work.


author: Bill Sheboy
body: Hi [@Maria DePasquale](/t5/user/viewprofilepage/user-id/3626373)

I appears Lookup Issues for the server/data center version has been completed and is "Waiting for Release". Please look here to follow progress: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-53>

Once that feature is available this scenario will be easier. At this time, I believe the work-around needed to update the epic is to call the REST API with a JQL search, as this will produce a list of issues from which the child-issue fields can be summed.

Kind regards,  
Bill


author: Maria DePasquale
body: Thanks @\[deleted\] but I'm not quite sure how to call the REST API. I was hoping someone had a concrete example, like everyone has for the Cloud version, to help me figure this out. I can't seem to get the right JQL and possibly, I don't have it in the right location in the Automation anyway. Also, we just upgraded Jira so if anything new is coming out, I won't see it anytime soon.


author: Bill Sheboy
body: This how-to walks through calling a REST API function, and I suspect it will help for Jira Server / Data Center also.

The JQL you need would be to find any issues having the Epic Link for the epic you want.

And a couple of possible REST API functions to call would be:

get issues for epic: <https://docs.atlassian.com/jira-software/REST/9.10.0/#agile/1.0/epic-getIssuesForEpic>

search for issues with JQL: <https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples>


author: Maria DePasquale
body: Thanks @\[deleted\], I have this working. It takes three Automations.

**Rule 1: Set up Triggers**   
This is the first automation rule that will get triggered whenever there is a change to "Story Points" field in any tickets. It is mainly used to set up the properties that will be used to

WHEN  
- Field value changed: Story Points  
ISSUE FIELDS CONDITION  
- Field: Issue Type  
- Condition: is not one of  
- Value: Epic, Spike  
SET ENTITY PROPERTY (this is used as an indicator in rule #2 that this is the triggering issue amongst all other task in the Epic)  
- Entity Type: Issue  
- Property Key: epicSumTrigger  
- Property Value: true (note: the actual value does not matter i.e. you may set any other values, but it has to match the validation in one of the step in rule #2)  
BRANCH RULE / RELATED ISSUES (this is used to trigger rule #2 such that we can use another branch rule to find all tasks of the Epic to get the summation of the story points)  
- Type of Related Issues: Epic (parent)  
- Process all issues produced by this trigger in bulk: ??  
- then, SET ENTITY PROPERTY  
--- Entity Type: Issue  
--- Property Key: updateStoryPoint  
--- Property Value: true (note: the value does not matter, it used to trigger rule #2 and we do not validate the value)  

**Rule 2: Summation of Story Points**   
This will get triggered from rule #1. We need this intermediary step because we are unable to set the story point of the Epic directly after we do the summation using branch rule --- Stories (or other issues in Epic).

Rule Details

\* ?? Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule.

WHEN  
- Issue Property Updated: updateStoryPoint  
ISSUE FIELDS CONDITION  
- Field: Issue Type  
- Condition: Equals  
- Value: Epic  
BRANCH RULE / RELATED ISSUES  
- Type of Related Issues: Stories (or other issues in Epic)  
- Process all issues produced by this trigger in bulk: ??  
- (we only need 1 of the task to get updated and trigger rule #3. but since all the tasks in Epic will get affected due to this branch rule, rule #3 will get triggered multiple times \[resetting the Epic story point of the same value over and over again\] whenever the property is set to each of the tasks in the Epic, we have to split into 2 steps:  
--- a. Set the summation to a temporary property of all the tasks  
--- b. If "this" issue is the original triggering issue, then set the summation to a property that will trigger rule #3)  
- then, 1. SET ENTITY PROPERTY (step a)  
--- Entity Type: Issue  
--- Property Key: epicSPTemp  
--- Property Value: {{issues.Story Points.sum}}  
- 2. ADVANCED COMPARE CONDITION (step b.1)  
--- First Value: {{issue.properties.epicSumTrigger}}  
--- Condition: Equals  
--- Second Value: true (this matches what we set in rule #1)  

**- 3. SET ENTITY PROPERTY (step b.2)**   
--- Entity Type: Issue  
--- Property Key: epicSP  
--- Property Value: {{issue.properties.epicSPTemp}}  
Rule 3: Set the summation to Epic  
This is the final rule used to set the Epic's story point field using a property in original triggering issue.

Rule Details

\* ?? Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule.

WHEN  
- Issue Property Updated: epicSP  
ISSUE FIELDS CONDITION  
- Field: Issue Type  
- Condition: is not one of  
- Value: Epic, Spike  
BRANCH RULE / RELATED ISSUES  
- Type of Related Issues: Epic (Parent)  
- Process all issues produced by this trigger in bulk: ??  
- then, EDIT ISSUE  
--- Story Points: {{triggerIssue.properties.epicSP}}  
SET ENTITY PROPERTY (to reset the property so that rule #2 will not get affected in the next occurrence)  
- Entity Type: Issue  
- Property Key: epicSumTrigger  
- Property Value: false


author: Bill Sheboy
body: Thanks for that information! I have seen that solution pattern before for some edge cases in Jira Cloud, although...

That last trigger does not exist for Jira Cloud automation...but then again, the Lookup Issues route is easier for cloud :\^)


author: Shabbir Anower
body: Can anybody help me to get the automation rules for summing Story Point estimates of Story issues under particular EPICs under a Team-based project, where Story Point estimate is available instead of Story Point?


author: Shabbir Anower
body: ![Sumup stories.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/281057iB723104D76FB07D9/image-size/large?v=v2&px=999 "Sumup stories.jpg")


author: Bill Sheboy
body: Hi [@Shabbir Anower](/t5/user/viewprofilepage/user-id/5310741)

Company-managed projects use the "Story points" field and Team-managed projects use the "Story point estimate" field...even though both are called "Story Points" in the UX.

In your rule, please try changing to use:

```
{{lookupIssues.Story point estimate.sum|0}}
```

I added handling for a default value of 0 when there are no sizes for the stories.

Kind regards,  
Bill


author: Shabbir Anower
body: Hi Bill,

Showing success, but not summing up in Epic. Details in the attachment.![automation rules.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/281069iD9ECBC50F6883DC9/image-size/large?v=v2&px=999 "automation rules.jpg")![outcome.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/281070iBAC23E7A9ABED5A3/image-size/large?v=v2&px=999 "outcome.jpg")


author: Shabbir Anower
body: My problem for summing up from Stories to Epis is solved, when I used JQL for particular project and Epic key (Test-1).

But when changes in sub-task, it's not updated in Epic Story Points


author: Bill Sheboy
body: As noted earlier: team-managed projects use the *Story point estimate* field and not the *Story points* field, even though in the UX for issue views it is displayed as "Story Points".

The edit issue action in the rule cannot use the drop-down to select the Story Points field as that will change the wrong field. Instead the rule must use the [advanced edit with JSON](https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Number-custom-field), like this:

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


author: Shabbir Anower
body: Thanks Bill.

Is there any way forward for summing Story Points for sub-tasks along stories under a particular EPIC?


author: Bill Sheboy
body: Although it would be possible to build rules to do this...

Sub-tasks normally do not have story points, as story points help with items (stories/tasks) built and released to production while sub-tasks are pieces of work that contribute to completing a story/task, and are not released to production.

What problem are you trying to solve?


author: Joseph Meldrum
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) Hello Bill - Firstly, yeomen's work here helping the needy community. It is so very much appreciated!!!

I have a similar question as Shabbir but slightly different. We use a "Task" issue type vs "Sub-Task" so that we can move "tasks" between sprints if needed given the way subtasks are married to their parent ticket. As a result, we're trying to rollup Task story points to Stories.

I've read enough of your responses to say I am in a company managed project. My edit formula reads: {{issue.Task.Story points.sum}}.

The automation is showing as it was updated successfully; however, no changes are present in the field. Any guidance is appreciated!

One interesting observation - I did try adding the \|0 to the end and it did actually update to zero. When I remove the \|0 it empties the field. So it is reaching this field; however, it doesn't seem to take on the values I input into the task.

![Rule.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/282840i82671524DF643C92/image-size/large?v=v2&px=999 "Rule.PNG")


author: Bill Sheboy
body: Hi [@Joseph Meldrum](/t5/user/viewprofilepage/user-id/5325962) -- Welcome to the Atlassian Community!

First thing, I recommend creating a new question and linking back to these older threads. Otherwise only the people following them will see your question, limiting the amount of ideas you get.

Next, your rule is missing a [Lookup Issues action](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues). Using JQL, that would gather the relevant issues and then allow using the *sum* function.

And then you will want to be careful to *branch to only the linked user story* you want to update. That will make your rule faster and reduce the chance of errors.

Kind regards,  
Bill


author: Joseph Meldrum
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) Thanks Bill! Yes I'm a newbie to the community, so I will be sure to do that moving forward. This thread is quite long, so understand.

I need a little help though with the Lookup - firstly, where in the rule structure does the Lookup action need to exist based on what I have currently defined? Secondly, can you help me with the syntax? Would I need to change the final syntax as well ({{issue.Task.Story points.sum}})?


author: Bill Sheboy
body: Before you proceed, given what you described please consider if instead your "stories" should be Epics and the "tasks" can be linked as children of the Epic. That will greatly simplify what you are trying to do as it can use built-in features of Jira.

I gave a link to the documentation for Lookup Issues, and I encourage both reading that and experimenting a bit. Both are needed to be successful using rules. And also, learning about [creating JQL statements](https://support.atlassian.com/jira-software-cloud/docs/what-is-advanced-search-in-jira-cloud/), when needed for rules.

As for changes to your rule, here's an outline of the changes (in italics). **Please review your current situation to confirm the link types for the JQL statements.**

* trigger: value changes for Story Points
* condition: issue type equals Task
* *action: lookup issues with JQL, to find the Story first*
  * *project = yourProjectName AND issueType = Story AND issue IN linkedIssues({{triggerIssue.key}}, "Related To")*
* *advanced compare condition: to confirm there is only one Story linked*
  * *first value: {{lookupIssues.size\|0}}*
  * *condition: equals*
  * *second value: 1*
* *action: create variable, to save the Story's key for later*
  * *name: varStoryKey*
  * *value: {{lookupIssues.first.key}}*
* *action: lookup issues with JQL, to find the sibling Tasks*
  * *project = yourProjectName AND issueType = Task AND issue IN linkedIssues({{varStoryKey}}, "Related To")*
* *branch on JQL: key = {{varStoryKey}}*
  * *action: edit to set the story points field of the "parent"*
    * *{{lookupIssues.Story points.sum\|0}}*


author: Joseph Meldrum
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) Thanks so much for the guidance! Yes, I know we're running this a bit unorthodox here - we are using EPICs but I would say we're using them at an "intiative" level with Stories acting as a "layer" in between the tasks and epics. I'd change it if I could...I disgress.

I tried to mirror what you've recommended and have worked through a few syntax issues...for example, it gave me and error using the '(' around the linkedIssues so I modified that to say **issue in** *linkedIssues({{triggerIssue.key}}, "Related To")*

Now I seem to be encountering a different issue where the second lookup isn't consuming the created variable. In the error, its not showing the present of the {{varStoryKey}}

![rolluperror.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/283073i2303242C4CBDF90F/image-size/large?v=v2&px=999 "rolluperror.PNG")


author: Bill Sheboy
body: Thanks for finding my error; I corrected the earlier post.

That seems to indicate the created variable is empty, or is interpreted as empty. Let's confirm both:

First, please add a write to the audit log after the variable is created to check:

```
the saved story key is: {{varStoryKey}}
```

Then, let's change that second lookup issues JQL to this:

```
project = yourProjectName
 AND issueType = Task
 AND issue IN linkedIssues("{{varStoryKey}}", "Related To")
```


author: Joseph Meldrum
body: Hey [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) it turns out I had a typo with {{lookupIssues.first.key}} - I did not have the "." between first and key. I was also missing the **key=**{{varStoryKey}} in the branch. After those fixes it works as expected.

Thanks again!


author: Peter Bosse
body: i have this working, but only for some Epics. Seems there is a limit to the lookup of 100 entries in the lookup table. We have reached that limit now, so it does not work for any new epics and tasks created. Is there any way to increase the lookup number? I have tried making it dependent on "assigned area" to split it up, but to no avail...


author: Bill Sheboy
body: Hi [@Peter Bosse](/t5/user/viewprofilepage/user-id/3951944)

Short answer: no, the limit for the Lookup Issues action is 100 issues, as described here <https://support.atlassian.com/cloud-automation/docs/automation-service-limits/>

The specifics of any possible work-arounds depend on your scenario. For example...

* When the rule will *update an epic is based on changes to a child issue field*, the limit may not matter unless there are more than 100 child issues in the epic
* When *using a scheduled trigger to update multiple epics* periodically, one possible work-around is to use JQL with the trigger and only update epics where the field (e.g., story points) is not yet set. Then the rule can run until caught up.

For any other scenario, I recommend creating a new question and...

1. provide a link back to this thread;
2. explain the problem you are trying to solve;
3. include an image of your current complete rule;
4. include images of any relevant triggers, branches, actions, and conditions;
5. include an image of the audit log details showing the rule execution; and,
6. explain what is not working as you expected.

The value of the new question is this is an older thread, and making a new question will increase the audience who can help / offer suggestions. Thanks!

Kind regards,  
Bill


author: Peter Bosse
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) thanks for your reply. I noticed this thread after i had put up my own on the topic. But yes lets continue in the new thread instead, and i will also follow your guidelines and try to emplain a bit more. Thanks for helping out.