Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 3.58 KB

automation-sum-of-story-point-estimate.md

File metadata and controls

46 lines (31 loc) · 3.58 KB

Automation - Update Story point estimate of parent task when subtask field changes

User story

  • The Story point estimate field for a task with subtasks should equal the sum of its subtasks' values for the same field.
  • When I change the Story point estimate value of a subtask, the same field of the parent task should update so it still equals the sum of the subtask Story point estimate fields.
  • Ideally, each story's Story point estimate value should also be a sum of the same field of its tasks, but this seems more complicated because of a limitation of Jira's smart values for issues and because in this project, tasks/issues are not children of a story. They are just related to it. Maybe it's better if they have a parent-child relationship, but I'm not sure how many levels this can span.

{{issue.parent}} - Accesses the details of a subtask's parent issue. Can only be used when the active issue is a subtask, and can't be used to access a standard issue's parent issue.

Solution

I made an automation with the following logic (pseudocode):

const targetField = 'Story point estimate'

if (changedValueForField(targetField) && changedFieldBelongsTo(Subtask)) {
    const parent = getParentOf(Subtask)
    parent.setFieldValue(targetField, sumOf(parent.subtasks.targetField))
}

Notes

My project was a team-managed project but the tutorial used company-managed Jira, so the name of the fields were different. From relevant docs:

{{Story Points}} - Returns the story points for the issue (company-managed Jira Software)

{{Story point estimate}} - Returns the story points for the issue (team-managed Jira Software)

Here are the changes required to make the tutorial code work in my case:

Change Jira Tutorial ❌ Working Solution ✅
field watched Story Points Story point estimate
issue type monitored Sub-task 하위 작업 (Sub-task in Korean)
field to edit Select Story Points from dropdown More options => JSON = {"fields":{"Story point estimate": {{issue.subtasks.Story point estimate.sum}}}}
  • This tutorial from the Atlassian template library was helpful, but required some changes to work for my unique situation. Here is an interactive rule from the tutorial.
  • Only single-project automations are possible on the Standard version of Jira. The Premium version allows global and multi-project automations. (Details)

Docs

  • These docs on Jira Automation cover the basics and link to more useful details.
  • Docs for advanced field editing using JSON.