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

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

Neil Wills
Contributor
June 22, 2021

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?

9 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2021

Hi @Neil Wills  -- Welcome to the Atlassian Community!

You can do that easily with the Lookup Issues action, 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

Neil Wills
Contributor
June 22, 2021

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.

Like Bill Sheboy likes this
Neil Wills
Contributor
July 6, 2021

Looking at the Epic history, I am resetting Story Points to None

I tried using:  

{{lookupIssues.Story Points.sum}}
Like Steve Caballero likes this
Neil Wills
Contributor
July 6, 2021

screenshotofruledefinition.JPG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

Hi @Neil Wills 

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"
Like Sven Reiser likes this
Neil Wills
Contributor
July 6, 2021

To confirm, this is a company manage project

Neil Wills
Contributor
July 6, 2021

I see that Epic Name is available, the field Epic Link is not listed in the dropdown

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

Hi! To which dropdown are you referring?

Neil Wills
Contributor
July 6, 2021

Progress screenshotofruledefinition3.JPG

Neil Wills
Contributor
July 6, 2021

screenshotofruledefinition4.JPG

Neil Wills
Contributor
July 6, 2021

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

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

Neil Wills
Contributor
July 6, 2021

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.JPGruledef-didnotwork2.JPG

Neil Wills
Contributor
July 6, 2021

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)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

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.

1 vote
Jon Zacharias January 24, 2022

@Neil Wills @Bill Sheboy 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.png2022-01-24_15-25-55.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2022

Hi @Jon Zacharias 

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

Jon Zacharias January 24, 2022

@Bill Sheboy 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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2022

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.

Jon Zacharias January 24, 2022

@Bill Sheboy 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.pngpic2.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2022

Oops...my bad!

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

{{triggerIssue.project.key}}

Jon Zacharias January 24, 2022

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.pngpic4.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 25, 2022

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.

Like Kevin likes this
Jon Zacharias January 25, 2022

@Bill Sheboy 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

Like # people like this
Stuart Nealis
Contributor
April 1, 2022

Thank you to both @Jon Zacharias and @Bill Sheboy for this detailed troubleshooting, it helped me implement this without issue. Cheers guys!

Like # people like this
Neil Wills
Contributor
April 25, 2022

Let me know if you run into continued issues

Finnlay Morcombe
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 6, 2024

Hi @Bill Sheboy 

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 Here is my Edit issue3 JQL: {{lookupIssues.Story point estimate.sum|0}}

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 7, 2024

Hi @Finnlay Morcombe -- 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

0 votes
Alfredo Maria FIAMMELLA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 11, 2024

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

Stuart Nealis
Contributor
September 11, 2024

Hi @Alfredo Maria FIAMMELLA , 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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2024

Hi @Alfredo Maria FIAMMELLA -- 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

Alfredo Maria FIAMMELLA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2024

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2024

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!

0 votes
Bijal Patel July 19, 2023

Hi @Bill Sheboy 

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.PNGSP 1.PNGSP 3.PNG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2023

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.

Bijal Patel July 19, 2023

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.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2023

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.

0 votes
Stuart Nealis
Contributor
July 19, 2023

Hi @Bill Sheboy , 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.pngimage.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2023

Hi @Stuart Nealis 

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

Stuart Nealis
Contributor
July 19, 2023

image.png

Hi @Bill Sheboy , 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. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2023

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?

Stuart Nealis
Contributor
July 21, 2023
  • 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.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 22, 2023

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}};
Stuart Nealis
Contributor
July 24, 2023

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

0 votes
Reysla Chiaradia
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2023

@Bill Sheboy, 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?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2023

Hi @Reysla Chiaradia -- 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

David Peles
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 16, 2023

Hi @Bill Sheboy , 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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2023

Hi @David Peles -- 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

0 votes
Ron McFarlane September 16, 2022

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.pngScreenshot 2022-09-16 173521.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2022

Hi @Ron McFarlane 

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

Henrik Ekenberg April 16, 2023

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.PNGjira1.PNG 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2023

Hi @Henrik Ekenberg -- 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

Henrik Ekenberg April 16, 2023

Hi,

 

Before post last message tested this but without success.

Maybe wrong way get lookupIssues ?

 

//H

 

jira3.PNG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2023

Hi @Henrik Ekenberg 

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!

Henrik Ekenberg April 17, 2023

Hi,

 

I use Server / Data Center version.

So no work around ?

 

//H

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2023

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.

0 votes
Joshua Yu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 8, 2022

Screen Shot 2022-06-08 at 9.57.59 PM.png

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

scott-altman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 2, 2023

Whats in your Then: Edit Issues fields Advanced section?

0 votes
Fernando Cirino Sato
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 17, 2022

Hi, it seems lookupIssues option is not avaiable for Jira Server. Any WA to make it work on Jira Server version?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2022

Hi @Fernando Cirino Sato -- 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

Like Fernando Cirino Sato likes this
Neil Wills
Contributor
July 21, 2023

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. 

Like Bill Sheboy likes this
Maria DePasquale
Contributor
August 28, 2023

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.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2023

Hi @Maria DePasquale 

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

Maria DePasquale
Contributor
August 28, 2023

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.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2023

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

Maria DePasquale
Contributor
August 28, 2023

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2023

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  :^)

Shabbir Anower September 16, 2023

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?

Shabbir Anower September 16, 2023

Sumup stories.jpg

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2023

Hi @Shabbir Anower 

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

Shabbir Anower September 16, 2023

Hi Bill,

Showing success, but not  summing up in Epic. Details in the attachment.automation rules.jpgoutcome.jpg

Shabbir Anower September 23, 2023

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2023

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, like this:

{
"fields": {
"Story point estimate: {{lookupIssues.Story point estimate.sum|0}}
}
}
Shabbir Anower September 23, 2023

Thanks Bill.

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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2023

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?

Joseph Meldrum September 25, 2023

@Bill Sheboy 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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2023

Hi @Joseph Meldrum -- 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.  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

Joseph Meldrum September 26, 2023

@Bill Sheboy 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}})?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2023

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, 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}}
Joseph Meldrum September 26, 2023

@Bill Sheboy 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

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2023

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")
Joseph Meldrum September 27, 2023

Hey @Bill Sheboy 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!

Like Bill Sheboy likes this
Peter Bosse March 20, 2024

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... 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2024

Hi @Peter Bosse 

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

Peter Bosse March 21, 2024

@Bill Sheboy 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.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events