Forums

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

Recalculating a field with Automations / Smart-values

Michael Beatty November 9, 2021

Hello,

I'm using two fields to track work using Story Points and Story point estimate.  I'm using Stories as my parent level of work, and then subtasks beneath them.  A Story Point value is assigned to each subtask.  Then as development is completed, the Story point estimate is updated to reflect how many story points you estimate have been completed.  I'm running an automation to then figure out a percentage complete

When: value changes for Story Points, Story point estimate

Then: Edit issue fields PercentDone {{#=}}({{issue.Story point estimate}} / {{issue.Story Points}}) * 100{{/}}

This works fine.

I've also got automations that "bubble up" the sum of all Story points and story point estimates to the parent issue (The main story).  This also works fine.

The problem I'm running into is that the main Story, the Percent Done is not getting recalculated when I update a sub task's values.   The value's are bubbling up, but the precent done doesn't change.  If I go back to the main Story, and change the values directly, the Percent Done calculation triggers and works just fine. 

In other words, the "Percent Done" is automation is only triggering if I go into the issue and manually change the values.  It doesn't change if the values are change by another automation.

Any ideas how I could get around this?

1 answer

0 votes
Michael Beatty November 10, 2021

I was able to figure it out and was able to compress them all into a single automation.  The issue I was having was that I was putting all the statements in the same "For Parent" condition.  For parent then edit issue fields Story Points AND edit issue fields Story point estimate AND edit issue fields Percent Done = story point estimate / story points.

What I've learned (and was made pretty evident by the "And:" statements in the flow, that these tasks all run asynchronously within that block.  So the story point estimate / story point math was happening at the same time the fields were updating so they were getting updated with the original value. 

I was able to solve this by moving the Edit issue fields Percent Done for the parent into a separate block.  So that the first block runs and updates the story points and story point estimate fields first.  Then that block ends.  Then a second For parent block runs which does the math.

 

Screen Shot 2021-11-10 at 9.46.05 AM.png

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 10, 2021

Hi @Michael Beatty -- Welcome to the Atlassian Community!

A few observations to help:

  • When you have a rule that you expect to be triggered by the actions of another rule, look at the Details section of the dependent rule, and enable Allow Rule Trigger.  Otherwise the rule engine detects a potential runaway/looping error and prevents triggering.
  • Next, rules components (steps) run synchronously except for branches that could return more than one issue.  So for your branches that could only return one (e.g. For Parent) the rule is in-lined to run synchronously.  Multiple issue branches run asynchronously and are not even guaranteed to finish before the other steps.
  • Instead what I believe you observing is that if you edit an issue in a rule and then try to use the updated values later, it is using the values at rule start time, not from the edits.  To use the updates you may add a Re-fetch action that reloads the data before proceeding.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer