You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi,
I'm trying to sum original estimated hours of stories and test cases at epic level in a custom field.
I have put the following logic but it is not working:
When: value changes for Original Estimate
If: Issue Type is one of Story, Test Scenario
AND: Issue matches JQL
issuekey in (childIssuesOf({{issue.epic}})) AND issuetype in (Story,"Test Scenario")
THEN: Edit issue fields
Effort estimated
set value
issueFunction in aggregateExpression("originalEstimate.sum()")
Any help would be much appreciated.
Hi @Farrukh Elahi -- Welcome to the Atlassian Community!
For a question like this, I recommend posting an image of the complete rule, images of the relevant actions / conditions /branches, and of the audit log details showing the rule execution. Those will provide context for the community to offer suggestions.
Until we see those...
For your Jira Server instance, do you have the Lookup Issues action? If so, you could use that to gather the issues using JQL, sum the field value, and then branch to the epic to edit the field.
If you do not have Lookup Issues, you could instead use a Send Web Request action to call a REST API function to gather the issues using JQL, and then use the same approach as above to sum the field and update the epic.
Kind regards,
Bill
Hey Bill,
Thank you for your response!
I have added the screenshots, I think I can't use a function while setting the value of a field.
I'm not sure If I quite follow you regarding your second comment for lookup issue, are you talking about {{lookupIssues}}?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for posting your rule images.
You are trying to use ScriptRunner functions in the automation for Jira rule to sum the values, and I do not believe that is possible: automation rules do not understand things like aggregateExpression(). I recommend checking the ScriptRunner documentation if you want to try that without an automation rule.
I was asking about your Jira version because automation rules have different ways to perform batch operations, such as summing values, based on version:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are using version 8.20.22.
Is there any alternative to sum the original estimate for specific issues and add that to a custom field at epic level?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes: the alternatives which I already listed above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Issue function is working in JQL but still I'm unable to set aggregate data value. There are no errors in audit logs but the field is not getting updated with the correct value, any leads would be highly appreciated. I have tried following values but no luck:
{{Issue.Aggregate data value}}
{{issue.epic.lookupIssues.originalEstimate.sum}}
{{lookupIssues.originalEstimate.sum}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using Jira Server or Jira Data Center?
I can see a Lookup Issues action in your rule, however I thought that was only available for Jira Cloud and Jira Data Center.
Does the Lookup Issue action return the issues you expected?
If it does, please try this smart value:
{{lookupIssues.timetracking.originalEstimateSeconds.sum}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think its Jira Data Center. The help text says it supports lookup issues but I'm not getting any results.
Thanks for your help though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
According to the audit log you showed, the lookup issues is getting issues back.
If you use the JQL for the lookup issues, and the example issue when the rule triggered, please try to run that JQL stand-alone with an issue search.
Then check if any of those issues have an original estimate.
I suspect the problem may be the inclusion of the aggregateExpression() function in the JQL. As you are using the Lookup Issues to perform the sum, the aggregate should no longer be needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have removed the aggregateExpression() function, but the following smart value is not returning anything:
{{lookupIssues.timetracking.originalEstimateSeconds.sum}}
When I run the same query in JQL, it works fine and returns aggregate data value (please see capture4.png below)
Probably this smart value is not supported, just for testing I tried {{issue.fields.aggregatetimeoriginalestimate}} and it is returning the Original Estimate of the triggered issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suspect this is related to the lookup issues being recently added for Jira Data Center:
When lookup issues was first added for Jira Cloud, it only supported a subset of the issue fields. Later, all of the other fields were added. The same may be true for Data Center's automation action.
That can immediately be confirmed by writing this to the audit log after the lookup issues action:
Here is the time tracking: {{lookupIssues.timetracking}}
If that is empty, lookup issues will not work for your scenario.
In that case, the other way to do this, and to later edit an issue, is using a Send Web Request action to call the REST API for an issue search with JQL. The web response fields can then be summed, just like with lookup issues.
If you want to try that approach here are some references:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Issue function is working in JQL but still I'm unable to set aggregate data value. There are no errors in audit logs but the field is not getting updated with the correct value, any leads would be highly appreciated. I have tried the following values but no luck:
{{Issue.Aggregate data value}}
{{issue.epic.lookupIssues.originalEstimate.sum}}
{{lookupIssues.originalEstimate.sum}}
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.