I would like to create an automation that triggers on schedule, filters with JQL relevant Epics or Stories (Simple query on a specific field) and per each, it calculates:
looking at a previous discussion (https://community.atlassian.com/t5/Jira-questions/Automation-Rule-calculate-progress-based-on-children-of-linked/qaq-p/2159555) led by @Bill Sheboy i still wasn't clear how to use the suggest smart valueThanks..!
Hi @Gilad Waldman
I see two things with what you show:
1) There is no Lookup Issues action in your rule to gather the issues.
2) The expression you show is missing the closing parenthesis and digits for the ROUND function. In my original post, I showed this:
{{#=}}ROUND((0+{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}{{Story points|0}}+{{/}}{{/}}0)/{{lookupIssues.Story points.sum|0}}*100,0){{/}}
Kind regards,Bill
Hi Gilad,
Which part is giving you a headache?
{{#=}} Start a calculation
ROUND((0+ Round the number function
{{#lookupIssues}} Iterate over the issues looked up by a jql statement
{{#if Start a conditional statement
(equals Look for equal parts A and B
(status.statusCategory.name Part A, the status of the looked-up issue under investigation
,"Done") Part B, is the status equal to Done
)}} Conditional statement is finished, could be true or false
Conditional is true, do the following
{{Story points|0}} Read the issue's story points. if that's empty, use zero
+{{/}}{{/}}0) Ends the if when conditional is false, add zero
/{{lookupIssues.Story points.sum|0}}*100 Sum up the story points of all issues (if sp is null use zero)
,0) give zero as an answer for this issue if the denominator is zero
{{/}} End the calculation
Thanks @Dick for the clarification. ill be more specific
Im getting this error: Mismatched parentheses: ROUND((0+0)/0*100
While using this calculation:
{{#=}}ROUND((0+{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+{{/}}{{/}}0)/{{lookupIssues.Story points.sum|0}}*100{{/}}
I suspect my problem is related to {{#lookupIssues}} but not 100% sure.
Thanks @Bill Sheboy !
Although made these two modifications and don't get any error, the sum I get is "0".
Formula was fixed with your help :
{{#=}}ROUND((0+{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+{{/}}{{/}}0)/{{lookupIssues.Story points.sum|0}}*100,0){{/}}
And for this epic, i have 2 child issues, each has 3 SP - One is "done" and one "To do" so i was expecting to get "3" (or 50%)
Please post an image of the audit log details showing the rule execution. That may provide more context for what you are observing. Thanks!
Does that helps?
Hi Gilad
Thanks for elaborating a bit on the problem you're facing, makes it easier
The error is about parenthesis not matching (and message you post clearly has a closing parenthesis missing).
Looking at your math line, there's a discrepancy too:
{{#=}}ROUND( (0+{{#lookupIssues}} double open
{{#if(equals(status.statusCategory.name,"Done"))}}+ double open double closed
{{/}}{{/}}0) single closed
/{{lookupIssues.Story points.sum|0}}*100{{/}}
So I suggest removing the one surplus parenthesis after the word ROUND.
hope this helps,
Dick
I now notice that Bill's line also seemed to be missing a closing parenthesis.
With all the curly braces and parentheses, this can easily happen. So it's best to check using the above method to see if there is consistency in your formula's.
Resurfacing this one again as although automation works just fine thanks to @Bill Sheboy - I believe the logic is not working well..
The automation is time triggered, and i have used the lookup issue function to capture all child issues of certain tickets. To do so i used the enhanced scriptrunner function of "ChildrenOf".
Next, i created the variable to run over the lookup issues according to the logic Bill helped me to set (and again, thank you) :
What I wanted to do was to run on specific epics and according to their SP progress to run actions. The issue i suspect is happening is that the lookup is running on ALL CHILDREN and not divided per epic. In that case, i will never get a value per the epic completion rate.
Any ideas how to approach this logic?
If you want to run this for each Epic, please consider:
AND parent={{issue.key}}
It looks like you're new here. Sign in or register to get started.