Hello folks,
We have set up a custom field (number) for work item type. My aim is to create an automation rule the compute the avergae of this field for all linked work items. I tried to used this formula but i running in errors:
formula: {{#=}}{{lookupIssues("issue in linkedIssues({{issue.key}})").customfield_10065.sum()}} / {{lookupIssues("issue in linkedIssues({{issue.key}})").size}}{{/}}
error:
Hi @Saif Allah AZZAZA ,
I believe the error is caused by the way you constructed the lookupIssues part.
As far as I know, you need to add a "Lookup work items" action first, and then reference the result of the query as {{lookupIssues}} in a later step.
I have broken the rule down into separate steps and logged each step to validate:
1. Get the work items
Returns the list of the trigger issue and it's linked issues, to be referenced later as {{lookupIssues}}
2. Count the work items
Returns the number of items in the list.
3. Sum the custom field
Returns the sum of the number field.
4. Calculate the average
---
Once the separate steps are validated, you can make this more compact in two steps:
1. Get the work items
2. Calculate the average
{{#=}}{{#=}}{{lookupIssues.customfield_10065.sum}}{{/}} / {{lookupIssues.size}}{{/}}
I hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.