Automation For Jira - How to create a rule that sums up the story points from sub-tasks of a parent issue

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This article describes how to create an Automation Rule using the add-on Automation For Jira (for Jira Server/Data Center) meant to:

  • Calculate the sum of the Story Points field from all the sub-tasks of a parent issue (Story type issue, Task type issue, Bug type issue, etc...)

  • Copy that value to the Story Points field of the parent issue

Solution

Note that this implementation requires the configuration of 2 rules:

  • 1st rule

    • The purpose of this rule is to update the Story Points of the Parent issue as soon as the Story Points of one of its sub-task get updated, by executing the operation "Parent Issue Story points" = "Sum of Story points from all its child issues"

  • 2nd rule

    • The purpose of this rule is to handle the situation where a sub-task might be moved from one parent to another parent. In such case, the Story Points of the sub-task will be subtracted from the original parent, and added to the new parent

Configuration of the 1st rule

The rule will need to be configured as follows:

  • Add the Field value changed trigger with the following settings

    • Field to monitor: Story Points

  • Add an Issue field condition with the following settings:

    • Field: Issue type

    • Condition: Equals

    • Value: Sub-task

  • Add the following Branch rule

    • Type of related issues: Parent

  • Inside the Branch Rule, add the action below:

    • Edit Issue

      • In the Choose field to set menu, select Story Points, and paste the expression below:

{{issue.subtasks.Story Points.sum}}

  • Screenshot of the 1st rule:

Screenshot showing the automation rule

Configuration of the 2nd rule

  • Add the Issue Updated trigger

  • Add an Issue fields condition with the following settings:

    • Field: Issue type

    • Condition: Equals

    • Value: Sub-task

  • Add an Advanced compare condition with the following settings:

    • First value:

{{changelog.Parent Issue.FromString}}

  • Condition: "Does not equal"

  • Second value:

{{changelog.Parent Issue.toString}}

  • Add the following Branch rule

    • Type of related issues: JQL

    • JQL: copy the query below:

key = "{{changelog.Parent Issue.FromString}}"

  • Inside this Branch, add the Edit Issue action:

    • Choose fields to set... :

      • Select the Story Points field

      • Copy the expression below:

{{#=}}{{issue.Story Points}} - {{triggerIssue.Story Points}}{{/}}

  • Add the following Branch rule

    • Type of related issues: JQL

    • JQL: copy the query below:

key = "{{changelog.Parent Issue.ToString}}"

  • Inside this Branch, add the Edit Issue action:

    • Choose fields to set... :

      • Select the Story Points field

      • Copy the expression below:

{{#=}}{{issue.Story Points}} + {{triggerIssue.Story Points}}{{/}}

Screenshot of the 2nd rule:

Screenshot showing the second automation rule

Updated on August 22, 2024

Still need help?

The Atlassian Community is here for you.