Hello everyone,
I'm building an automation rule to calculate a progress percentage at the Story and Epic level based on a custom field called Business Points from child tickets. The Business Points are weighted as follows:
- 1 – Lowest
- 2 – Low
- 3 – Medium
- 4 – High
- 5 – Highest
The calculation I need to perform is:
(Sum of weights for children with status "Demo" or more advanced / Sum of weights for all children) * 100
My automation rule follows these steps:
1 - Trigger: When a Story’s status or Business Points change.
2 - Condition: Check that the issue is a Story.
3 - Retrieve Epic Parent: Get the parent Epic of the Story.
4 - Lookup Issues: Use a JQL query to retrieve all child Stories with:
"Epic Link" = {{parent}} AND issuetype = Story
5 - For JQL Branch: Iterate over the parent’s children.
6 - Extract Business Points:
I create a variable (let’s call it businessPointsList) that collects the Business Points from each child by extracting the numeric value before the "-" using:
{{#lookupIssues}}{{fields.customfield_12006.value.split("-").first}}{{^last}}, {{/}}{{/lookupIssues}}
7 - This displays correctly in my log, for example:
Business Points Log Display :1, 3, 4
Problem:
My goal is to sum the elements of this list to calculate the overall progress percentage, but I’m unable to perform the sum directly on businessPointsList using Jira Automation smart values.
Has anyone managed to sum the elements of a list (which in my case contains only numeric values) within Jira Automation? Are there any workarounds or best practices to accumulate a total from a list of smart values?
Any help or suggestions would be greatly appreciated!
Thank you in advance.