How to update sum of Estimate on Parent when sub-task MOVED into (parent change) ?
Asked by Dan H:

Hello,

So I have already rules setup in place for when an sub-task issue is created/edited/deleted, and these work perfectly. Here's one example below:

![SumEstimateParent.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/131241iDD60FC0C9A9BA7E9/image-size/large?v=v2&px=999 "SumEstimateParent.jpg")

However the only thing left is to get a rule working for when a **sub-task is MOVED / changed to a different Parent issue**, and to continue with updating Parent total Estimate based on Estimates from sub-tasks.

I've attempted using Parent Link from the Issue Updated trigger but unfortunately this does nothing.

So looking for an answer to help with this please : )


Answers:
author: Sherry Goyal
body: Hi [@Dan H](/t5/user/viewprofilepage/user-id/1299555)

Thought this would work by using "Field value change" with "parent link" field but no luck(for non next gen).

I have taken it as a [bug](https://codebarrel.atlassian.net/browse/AUT-2161). Thanks for the feedback.

Thanks  
Sherry

comments: author: Dan H
body: Thanks for investigating Sherry!

I hope you also don't mind me linking to another likely bug issue. You'll want to look at the **last 2 comments** on this post, which specifically talks about a bug issue found using the If/Else block condition (so ignore the original question posted);

<https://community.atlassian.com/t5/Automation-questions/How-do-I-specifically-use-Original-Estimate-for-Value-Changes/qaq-p/1591368>

I just wasn't sure how to report and log a bug issue for this myself, so appreciate if you can also look into this one too.

Thank you kindly!

Dan


author: Mariana Kyrova
body: Hi Dan! Great job you did! :) Would you mind sharing your rule for deletion of a subtask?

comments: author: Dan H
body: Hi Mariana,

Certainly, and apologies for the delay in this response - my email notifications were all off!

![deleted.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/179467iB1DF784DC3768F43/image-size/large?v=v2&px=999 "deleted.jpg")

So the Rule does the following:

1. Trigger on **Issue deleted**
2. Check if **Issue is a 'sub-task'** type (using JQL query)
3. If so, then **for Parent** issue...
   1. First refresh or **re-fetch the issue data**
   2. Then update the **Original Estimate** field, using the following calculation:

```
{{#=}}{{issue.subtasks.original estimate.sum}} / 3600{{/}}
```

Hope that is clear and helps!


author: Bill Sheboy
body: Hi [@Dan H](/t5/user/viewprofilepage/user-id/1299555)

Is this for a NextGen project? If so, you may be running into this defect:

<https://codebarrel.atlassian.net/browse/AUT-1987>

The only work-around I can think of is to use a scheduled rule to periodically refresh all parent estimates for their current children.

You could refine that work-around a bit by adding a custom field that has the LastParent, set on issue created, and only refresh estimates on schedule when the LastParent doesn't match the current one. During the refresh, ensure to also update LastParent.

Best regards,

Bill

comments: author: Dan H
body: Hi Bill, thank you for your suggestion.

Unfortunately I'm experiencing this issue with Classic project (I assume NextGen has the same then), and a member of the Atlassian team had commented above that it is likely to be a bug.

So I will just wait patiently for the fix in the meantime :)


Tags: estimate

hierarchy

issue-link

link

sub-task

time-tracking