Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Automation: Updating Custom Field on Epic Level -

joscha.reinhard March 17, 2025

Hello, 

I have the following automation in my project: 


The automations ensures that the custom field "Detail Sum Effort CON" at the Epic level is updated whenever the value of the custom field "Detail Effort CON" changes at the Story level.


Automation Workflow:

Trigger:

The rule is triggered when the field "Detail Effort CON" of an issue is modified.

Conditions: 

The issue must be of type Story (Issue Type ID: XXXX).

The issue must be linked to an Epic.

 

Actions within the Epic Branch:

Lookup Issues: A JQL search is performed to find all Stories linked to the same Epic.

The JQL query: "Parent" = {{issue.key}}

This means it searches for all Stories that have the same Epic as their parent.

 

Summation & Updating the Epic Field:

The field "Detail Sum Effort CON" in the Epic is updated with the sum of all "Detail Effort CON" values from the retrieved Stories:

{{lookupIssues."Detail Effort CON".sum|0}}

If no Stories are found, the value is set to 0. 

 

Potential Weakness of the Automation:


If a new Story is added to an Epic, the rule only triggers if its field "Detail Effort CON" is modified. 

If a Story is deleted, there is no direct trigger to update the sum. 

 

So far I have not found a working solution for these questions and hope that you can help me. 

 

Solutions: 

 

A separate rule with the "Issue Created" trigger to recalculate the sum when a new Story is added to an Epic.

 

A seperate rule with "Issue deleted from Epic" trigger to recalculate the sum when a Story is deleted from the Epic or deleted from the project. 

Regards, 

Joscha

 

image.png

1 answer

1 vote
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, 2025

Hi @joscha.reinhard 

For field sync / sum scenarios there are often many cases involved.  Deciding the accuracy and frequency will determine how many rules are needed and their respective logic.

Here are some of the cases to consider:

  1. Story is created with an Epic assigned --> update the Epic
  2. Story's field is changed when it has an Epic --> update the Epic
  3. Story is removed from an Epic --> update the previous Epic
  4. Story is added to an Epic --> update the new Epic
  5. Story is changed from one to another Epic --> update both the previous and new Epics (Overlap of #3 and #4)
  6. Story is deleted --> update the previous Epic (Special case of #3)
  7. Person manually changes the field in the Epic --> update the Epic to recalculate the sum
  8. Story and Epic issues exist before the rules were implemented --> using a Scheduled trigger rule, identify and update all of the relevant Epics
  9. Atlassian has a production delay (or outage) for rule execution --> As it is unknown if the rules will or will not "catch up" for the changes to run, use the Scheduled trigger rule from #8 above once the outage resolves.  There is such an outage happening right nowhttps://jira-software.status.atlassian.com/

Some of these rules can be combined, using conditional logic.  For example, # 3, 4, and 5.

Others are subject to problems / racetrack errors apparently due to defects in automation after the change to sunset the "Epic link" field and switch to the "parent" field.  For example, there are defects which would impact # 1, 3, 4, 5, and possibly 6.  Here are the defects if you want to watch / vote for them to see updates:

 

You also appear to have a Premium license level, and so have more automation usage capacity available.  When one has a Free or Standard license level, using this many rules to sync a field value could easily consume the monthly allocation for rules, halting their execution.  The workaround for that is to use a single, scheduled trigger rule to only update once per day.

 

Kind regards,
Bill

joscha.reinhard March 18, 2025

Hi @Bill Sheboy , 

thanks for your detailed breakdown and the provided information!

I have checked with my instance admin, and automation limits are not a concern at the moment. 

Here’s what I have addressed so far:

Story is created with an Epic assigned → update the Epic
➝ open

Story's field is changed when it has an Epic → update the Epic

➝ Already implemented: For example the field "Detail Sum Effort CON" in the Epic is updated when the field "Detail Effort CON" in a Story changes.

Story is removed from an Epic → update the previous Epic
➝ Open

Story is added to an Epic → update the new Epic
➝ Open

Story is changed from one to another Epic → update both the previous and new Epics
➝ Open

Story is deleted → update the previous Epic
➝ Open

Person manually changes the field in the Epic → update the Epic to recalculate the sum
➝ Not needed: I will remove this field from the Edit Screen at the Epic level to ensure manual changes are not possible. Efforts should only be added at the Story level.

Story and Epic issues exist before the rules were implemented → using a Scheduled trigger rule, identify and update all relevant Epics
➝Open: This is a great idea to ensure data integrity, e.g., by running a recalculation once per day.

I am currently struggling with the implementation of some of these rules and would appreciate your help.
Do you have example automations for the mentioned points.
I am particularly unsure how to structure the triggers and conditions for these cases.

Any example or hint in the right direction would be really helpful!

 

All the best, 

Joscha

joscha.reinhard March 18, 2025

It just occurred to me that we need another rule for when a story is rejected.
So, change the status to "Rejected."

Story Status is changed to rejected --> Values are removed from Epic. 

Regards, 

Joscha

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 18, 2025

I recommend incrementally adding rules; that will help see which ones can be combined and how. 

For example, for the issue created one...

  • copy your current rule
  • change the trigger
  • add the Re-fetch Issue action after the trigger (This helps prevent rule timing problems.)
  • test!

And repeat...

The most challenging ones are when the Parent field changes, as that would use the {{#changlog.parent}}{{fromString}}{{/}} smart value (and the current value) with conditions to access each Epic using branching.  That single rule could handle:

  • Story edited to first add to an Epic
  • Story removed from all Epics
  • Story changed from one Epic to another

 

joscha.reinhard March 24, 2025

Hi @Bill Sheboy 

 

I have now implemented the following. 
This seems to work good for now. 

"Recalculate the Sum Effort Detail on Epic X if story is deleted from this Epic
Recalculate the sum Effort Detail on Epic Y if story is added to this Epic"

Thanks for your help. 

Screenshot attached for the community. 

Snag_925c33.png

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events