I'm creating an automation that performs the following tasks:
On Trigger (manually), the automation is to sum up original estimate to an Epic custom field called Total Project Estimate. The rule retrieves all child tasks linked to the epic using JQL. It also retrives linked "Idea" issue to retrieve the original effort on the idea. Then, it takes the values of all child tasks and the original estimate of the idea and sums them up to the custom field Total Project Estimate.
The issue I'm having is that the calculation in the variable is mibehaving :D
When you look at the audit log you can see it clearly, but I'm banging my head trying to figure out the error of my ways.
Here is the audit log and rule:
It looks like a variable issue:
Regarding automation branches and created variable scope, there are two key things to know:
For your scenario, I recommend:
Also...as your rule initializes that field to 0, remember to add a Re-fetch Issue action immediately after that step to reload the data.
Kind regards,
Bill
Bill, this worked very well. I'm posting my automation so you can see how I solved it with your help. .
Thanks, again, and again, and again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure if I fully understand the final problem you are facing, please correct me if I'm wrong, but you were expecting to see 20 hours at the final results, right? 10 from Ideas 10 from child Total.
If that's the case, I would guess the problem is with declaring your ideaOriginalEstimate inside of the BranchLoop.
That's a long shot, but in normal programming languages, if you declare a variable inside of a loop or function, it often becomes inaccessible to the global scope of your code.
As Jira Automations is probably develop on similar principles, I would recommend you to create the Total Idea Hours variable before the Branch, test if it is accessible inside the branch afterwards, Create a second variable inside the Branch (current_IdeaHours - because you're looping through many ideas), then you add the value of the Total Idea Hours = Total Idea Hours + current_IdeaHours.
This would ensure you are storing the values you calculated inside the loop in a scope greater than the loop.
hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry if I wasn't clear, Idea total is 5, and Child Totals 10 = 15.
I'm going to step through your suggestion and see how to apply it here. I feel like I have to declare it inside the branch, but maybe I don't. hmmmm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh I see! That's ok, the core of the problem I got - only the wrong numbers.
You see in the last message of your log, we can see 0 hours for idea - that's what made me believe whatever you're storing inside the loop, isn't getting accessed outside the loop.
Try as I suggested, one internal variable, one external - and during the loop, the external receives the value of the internal.
Hope it works!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you were right about declaring inside the bench loop. You just can't do it! :D
Thank you for diving into this with me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Happy to help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am doing something similar i.e. summing up hours at epic level. I am relying on below function so that a loop on subtasks can be avoided. Save the calculated value in a smart variable and then editing the custom field in epic with the value set in smart variable.
{{#=}} {{lookupIssues.aggregatetimespent.sum}} / 3600 {{/}}
See if this helps you simply your workflow and fix the error that you are facing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.