Calculate the sum of original estimates of all issue types to an Epic using Automation

66 comments

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2022

Simon your rule seems ok. I've tested again my own and it's working alright.

I know that this can be a dumb thing to say, but you please check that your task/planung issue type has indeed a value? And when you make sure of that, can you go ahead and refresh the Epic page? It takes a while to update the field with the value.

Simon Huprich August 30, 2022

Hey Alex,
All the issue which are part of the epic have a value.
When the rule executes automatically, the value that I added manually was changed to "0m" again. (from 2h to 0m)

Like Jules Cuijpers likes this
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2022

Simon, copy and paste the following JSON to a new JSON file and import it as a new rule.

{
"cloud": true,
"rules": [
{
"id": 4585207,
"clientKey": "392b6b84-aff8-31f3-bbcf-d4dc4de7f1a3",
"name": "MINE: Sum Original Estimate in Epic",
"state": "ENABLED",
"description": null,
"authorAccountId": "5f9fb7c1c2e5390077abf628",
"actor": {
"type": "ACCOUNT_ID",
"value": "557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"
},
"created": 1639726658951,
"updated": 1661844588245,
"trigger": {
"id": "159519843",
"component": "TRIGGER",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 2,
"type": "jira.issue.field.changed",
"value": {
"changeType": "ANY_CHANGE",
"fields": [
{
"value": "timetracking",
"type": "field"
},
{
"value": "worklog",
"type": "field"
}
],
"actions": [
"edit"
]
},
"children": [],
"conditions": [],
"connectionId": null
},
"components": [
{
"id": "159519844",
"component": "CONDITION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 3,
"type": "jira.issue.condition",
"value": {
"selectedField": {
"type": "ID",
"value": "issuetype"
},
"selectedFieldType": "issuetype",
"comparison": "ONE_OF",
"compareValue": {
"type": "ID",
"modifier": null,
"value": "[\"10002\",\"10004\",\"10001\"]",
"multiValue": true,
"source": null
}
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "159519845",
"component": "BRANCH",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.issue.related",
"value": {
"relatedType": "epic",
"jql": "",
"linkTypes": [],
"onlyUpdatedIssues": false,
"similarityLimit": 40,
"compareValue": 0
},
"children": [
{
"id": "159519846",
"component": "ACTION",
"parentId": "159519845",
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.lookup.issues",
"value": {
"id": "_customsmartvalue_id_1639726474486",
"name": {
"type": "FREE",
"value": "lookupIssues"
},
"type": "JQL",
"query": {
"type": "SMART",
"value": "\"Epic Link\" = {{issue.key}}"
},
"lazy": false
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "159519847",
"component": "ACTION",
"parentId": "159519845",
"conditionParentId": null,
"schemaVersion": 10,
"type": "jira.issue.edit",
"value": {
"operations": [],
"advancedFields": "{\n \"fields\": {\n \"timetracking\": {\n \"originalEstimate\" : \"{{lookupIssues.Original Estimate.sum .divide(60)}}\",\n \"remainingEstimate\" : \"{{lookupIssues.Remaining Estimate.sum .divide(60)}}\"\n }\n }\n}",
"sendNotifications": false
},
"children": [],
"conditions": [],
"connectionId": null
}
],
"conditions": [],
"connectionId": null
}
],
"canOtherRuleTrigger": false,
"notifyOnError": "FIRSTERROR",
"projects": [
{
"projectId": "10005",
"projectTypeKey": "software"
}
],
"labels": [],
"tags": [
{
"id": 13693947,
"tagType": "IS_RULE_UPDATED",
"tagValue": "true"
}
],
"ruleScope": {
"resources": [
"ari:cloud:jira:f1b53191-2545-46a7-841f-975e03eb0b9f:project/10005"
]
},
"writeAccessType": "UNRESTRICTED",
"collaborators": []
}
]
}

If the above rule fail to update the epic, then most likely something else is happening.

Try it and let me know.

Like Kalos Bonasia likes this
Andreea Cetateanu September 6, 2022

Hi @Alex Koxaras _Relational_ ,

After a lengthy search about how to create a rule that adds up Original estimate and Time remaining from a Story to an Epic, your post was a breath of fresh air. However, it seems that it is working only for Original estimates field, for me this rule is not working on of Time remaining field (the hours are not 'removed' at an Epic level when I log hours on a Story level).

I use an additional add on for time tracking (Tempo) is this the issue? or is there another issue?

P.S.: I only started to work with Jira Rules today.

Your answer is much appreciated!

Best regards,

Andreea 

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 6, 2022

Hi @Andreea Cetateanu and welcome to the community!

So what you are telling me is that:

  • You have implemented the rule
  • The rule runs properly and add the Original Estimate
  • But it doesn't do the same for the Remaining Estimate

For all your issues you use tempo to log your work. Correct?

Andreea Cetateanu September 6, 2022

Hi,

That's correct!

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2022

Can you try to log time on an issue using the native method and see what's the reaction of the rule? Does it work properly?

Nishanth October 10, 2022

Hi,

I having the issue in my automation rule. I tried to calculate Due date based on post function.

I attached my post function screenshot below 

Due date Post function.PNG
Based on function I created the automation rule. I added the smart value for this numeric expression as "{{issue.duedate}} - {{issue.timeoriginalestimate}} / {{8*60}}" in Due date . But when i execute this rule its not adding the due date field in the sub task.

rule img.PNGRule.PNG

I having doubt my smart value is correct or not. Please someone could help me for this issue

 

Regards,

Nishanth

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2022

@Nishanth hi and welcome to the community,

I believe that you should create a Jira question for this issue you are having. If you have any question regarding the automation I presented here, feel free to ask!

Thomas Christof October 11, 2022

Hi @Alex Koxaras _Relational_ 

Thanks for providing your setup.

Your trigger events are "Time tracking" and "Work logged". I am wondering what is the difference between them.

Anyhow, I have noticed they are not triggering the event when someone updates "Remaining Estimates" on a task or sub-task. So I thought to create a rule for calculating the aggregated values triggered by changes of remaining estimate. Unfortunately, Remaining Estimate is not in the list of fields for the "Field value changed" trigger.

Any idea how to set up a trigger for rolling up updates of remaining estimate?

image.png

Jen Doherty November 6, 2022

Thank you for the detailed article, it's really appreciated! However unfortunately I'm having some issues with this automation. I have recreated it exactly as written except only for story type issues, but the automation seems to be cumulatively adding to the epic's timetracking fields instead of replacing them.

For example, if I have an epic with no children and 0m original estimate and create a child story with 1h original estimate, the epic updates to 1h also - so far so good. But if I add a second child also with 1h estimate, the epic now updates to 3h - the original field (1h) plus the first child again (1h) plus the second child (1h).

The rule is successfully running with no issues in the audit log, and looking at the Atlassian documentation an update *should* do a set and replace the original value.

Any suggestions on how this could be fixed?

Rule details:

demand estimation automation.PNG

Jen Doherty November 6, 2022

After some further experimenting, I found the issue. Using "Epic Link" = {{issue.key}} did not work for me because our epic links are not just the issue key, they are text fields. So I was using (as you can see in the screenshot) parentEpic = {{issue. Key}} instead, which was also finding the epic itself. changing the lookup issues query to "parentEpic = {{issue. Key}} AND issuetype != Epic" has solved my issue.

Like # people like this
Neeraj Patil November 21, 2022

Hey @Alex Koxaras _Relational_ , Thank you for this.

I'm looking for the same with Sub-tasks to Story.

Instead of Log work and Remaining work fields, I'm planning to use Original Estimate field?
But as I see, Original Estimate Field is not showing up in the fields dropped down. 


Any thoughts there?

 

BTW, I had used a similar one for the Story Points, which is working smoothly.

 

Regards,

Neeraj

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

@Neeraj Patil on standard issue types there is a checkbox under time spent/remaining estimate to include subtasks. This works for the two fore mentioned fields but not for the original estimate. What fields do you want to sum up?

Neeraj Patil November 22, 2022

@Alex Koxaras _Relational_ I want my team to update the Original Estimate field to be updated for the Sub-tasks and that is reflected in the Story.

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

@Neeraj Patil this is fairly easy to change in the existing rule. You have to tweak a couple of things:

sum original estimate from subtasks to parents.png

Like # people like this
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

@Thomas Christof sorry for the late reply. I tried changing the remaining estimate and my rule triggers just fine.

Omer Gurtemel December 28, 2022

Hi @Alex Koxaras _Relational_ 

Thanks for sharing. It is the only one that I could achieve somehow a result!

However, it works on some specific cases:

  • Once a task is created as a child under the Epic, original estimate value of the task is added to the original estimate & time spent of the Epic --> OK
  • Once a task is updated by entering time spent in terms of hours,  remaining time of the Epic is updated accordingly --> OK
  • Once a task is updated by entering time spent in terms of others (weeks/days/minutes) , remaining time of the Epic is NOT updated accordingly --> NOK
  • Once a subtask is created under the task of the Epic, although remaining of task is updated accordingly, this update has no impact on the remaining time of the Epic --> NOK

 

Here is my automation details:

1.png

2.png

3.png

 

Like Kalos Bonasia likes this
Jules Cuijpers January 15, 2023

Hi Alex,

Thank you for this post.
Unfortunately I experience the same problem as @Simon Huprich 
The automation rule succeeds, but the Epic won't sum up the Original Estimate values from work items.
When the rule executes automatically, the value that I added manually was changed to "0m" again. (from 2h to 0m)

I also imported the JSON from @Alex Koxaras _Cententia, but the problem still exists.

Do you maybe have some other tips?

Thanks in advance!

Screenshot 2023-01-16 083957.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.
January 16, 2023

Hi @Jules Cuijpers -- Welcome to the Atlassian Community!

I note in the image you posted that there is an extra space after the sum function in the JSON.  Have you tried removing that?

Kind regards,
Bill

Jules Cuijpers January 17, 2023

@Bill Sheboy 

Thanks for the tip. I removed the space and the rule succeeds but the epics still stays on 0m.

Screenshot 2023-01-17 114841.png

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

@Jules Cuijpers 

It seems that no issues can be found during the lookup. Double check your JQL

Jules Cuijpers January 17, 2023

Thanks guys. I just found the solution. This works:

Screenshot 2023-01-17 155808.png

Like # people like this
Yevhen Matsiuk April 27, 2023

@Alex Koxaras _Relational_ Hi, thx for this post. 

The automation rule succeeds, but the Epic won't sum up the Original Estimate values from work items.
When the rule executes automatically, the value that I added manually was changed to "0m" again.image.pngimage.png

Do you maybe have some other tips?

Laurent May 4, 2023

Hello,

Thanks for that great job !

But I can't run that rule because of an error : 

Capture d’écran 2023-05-04 à 10.50.25.jpg

 

Could you help me ?

Thanks

Like Kalos Bonasia likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events