Jira Automation: Sum Story Points in Epic
This solution caters for ones that are using Jira Data Center (server). If you are using Jira Cloud version, you may find a simpler solution here where lookup issue action is available.
An alternative to lookup issue action is to do a lookup for issues in Epic using Jira endpoint. However, this would require you to use a token. You may read up more about the solution via this thread in Jira forum.
This article will share how we can sum the Epic story points without the need to use lookup issue action or personal access token.
In general, this solution requires 3 automation rules.
- Set up the triggers for step 2 and 3
- Do the summation of the story points of the issues in the Epic
- Set the summation to Epic story point field
Let’s start!
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
There you go! You do not need to do the summation manually anymore each time we add new tickets or update the story point of any epic task. 😏
If you are not a Medium member yet, click here to join!