Forums

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

increment/decrement epic original estimate field from user stories

JM
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!
October 29, 2021

I'm writing automation that, when the original estimate of the story is added, increased or decreased the epic original estimate will update.

{{#=}}({{fieldChange.to}}/3600 - {{fieldChange.from}}/3600 + {{issue.original estimate}}/3600){{/}}

Im using this above but its erroring out if the epic estimate is blank / 0 as the calculation needs base figure to calculate.
  

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.
October 29, 2021

Hi @JM -- Welcome to the Atlassian Community!

When you are using math on smart values, it can help to supply a default value with the pipe operator.  For your case that could be using zero (0) as:

{{#=}}({{fieldChange.to|0}}/3600 - {{fieldChange.from|0}}/3600 + {{issue.original estimate|0}}/3600){{/}}

If that does not work due to null handling for fieldChange, you may need an if/else structure to test {{fieldChange.from}} first.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer