update epic story points when a story is removed

Massaut
Contributor
September 28, 2024

I have an automation that scans all items linked to an epic (regardless of the project they are in) and assigns the sum to a custom Epico field called "Plan estimate". This rule is triggered when the "parent" field of the child item changes. I need to increase this automation by reducing the story point total when a child item is removed from the epic (deleted or broken parent-child relationship).


Captura de Tela 2024-09-28 às 10.25.14.pngCaptura de Tela 2024-09-28 às 10.25.28.png

2 answers

1 accepted

5 votes
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.
September 28, 2024

Hi @Massaut 

For a summing scenario like this, there are several cases to consider.  Please consider and decide which ones you want rules to cover them, such as the following:

  1. When an issue is created and assigned to an epic at the same time
  2. When an issue is updated and assigned to an epic for the first time
  3. When an issue is updated and assigned to a different epic (or to no epic)
  4. When an issue is converted to a new issue type, and no longer has a parent epic
  5. When an issue is deleted from Jira and it had a parent epic

For your question, cases #3 and #4 apply...

  • For case #3, the rule could be triggered on an issue update and use the changelog smart values to update the relevant "from" and "to" epics, with a branch for each.  This same rule could also handle the #2 case.
  • For case #4, this is quite challenging.  The rule would need to somehow check complete issue change log to find previous epic value.  A workaround would be adding a custom field (or entity property) specifically to store the value and not show it on the views, using that field in any epic updates.

 

Deciding how accurate the sums should be, and the impact on automation usage for the month, will influence your approach.  Another approach is to use a scheduled trigger rule, which updates all epics once per day.

I recommend discussing this need with your Jira Site Admin to decide which approach to use for your team and company.

 

Kind regards,
Bill

Massaut
Contributor
September 28, 2024

@Bill Sheboy, I'm the global Jira admin here at the company. Our Jira is enterprise, so I don't have problems with the number of automations, as they are unlimited.

I really need help putting together the rule (when a child item is removed from the epic, to subtract the equivalent value of that item).

I can't create this rule, I don't know where I could be going wrong. I have a rule for whenever an item is assigned to the epic, I have a rule for whenever there is a change in story points on assigned items, but when an item is removed from the epic, the story point value remains there, unless otherwise history changes in the story points field, so the field is updated.

With this explanation, did understanding become better?

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 28, 2024

First, as you note being the global Jira admin for your company, I strongly encourage you to learn more about writing and maintaining automation rules.  As your colleagues use the tool, they will need your support and you will want to ensure they do not cause harm to the site via rules.  Perhaps seek additional training from Atlassian on rules.

 

Next, I recommend reviewing the documentation on the changelog smart value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog--

With that smart value, a rule may detect the correct old / new epic.

Unfortunately...with the sunset of the Epic Link (and some other epic fields) still in progress, the replacement Parent field is not fully integrated for changes in rules yet.  Until that is completed, this template rule could be used to access the issues via the Epic Link changelog:

  • trigger: issue field changes for Parent
  • condition: issue type in Story, Task, etc. for the child issues of your Epics
  • branch: to parent
    • perform any updates for the new parent Epic...
  • smart value condition:
    • first value: {{#changelog.Epic link}}{{fromString}}{{/}}
    • condition: does not equal
    • second value: leave this empty
  • branch on JQL: 
    • key = {{#changelog.Epic link}}{{fromString}}{{/}} AND issueType=Epic 
      • perform any updates for the old parent Epic...

 

Massaut
Contributor
October 2, 2024

@Bill Sheboy 

After a few hours of trying, analyzing, reading and studying... I managed to make the scenarios I needed work, creating three different rules. Thank you very much for your help and encouragement in being able to resolve this on my own. It worked out.

Kunal Dhir
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!
November 13, 2024

Hey @Massaut , Can you share your solution on how you were able to subtract points when a child issue was removed from the Epic?

Like # people like this
Massaut
Contributor
December 17, 2024

@Kunal Dhir hello!

Of course! I will be happy to contribute to the solution.
Below are screenshots of the rule: 

Captura de Tela 2024-12-17 às 09.48.59.pngCaptura de Tela 2024-12-17 às 09.49.09.png

0 votes
bilyana_karayaneva
Contributor
November 29, 2024

2024-11-29_12-59-01.jpg

 

Hi All, I am struggling with the change epic Rule as I am making all those rules to cover very similar scenarios as above. But seems this is not wokring.  Any advice? 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.
November 29, 2024

Hi @bilyana_karayaneva 

Please post an image of your complete rule, in one single image, and of the audit log details showing the rule execution.  Those will provide context for the community to help.

Until we see those...

Please explain what is not working?

What you may be seeing is the Parent field replacement of Epic Link has not yet happened for the changelog in automation rules.  Instead please continue to use the old field:

{{#changelog.Epic link}}{{fromString}}{{/}}

Kind regards,
Bill

Like bilyana_karayaneva likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events