Hi all,
I'm struggeling calculating the sum of a number of objects in an automation rule. I can't get the formula to work. Maybe i'm doing something wrong, or maybe it just doesn't work at all.
This is what I want to do in my automation rule.
1. I create a variable "Total" and set it to 0.
2. I use a "Lookup Objects" action to get a number of objects from the asset DB. Each object has an "Integer" attribute called "Amount"
3. I want to make the sum of these "Amount" values, and store this total in the "Total" variable
For some reason, calculating the total doesn't work. Below screesnhots of my automation rule.
Best regards,
Kris
Branches which could be on more than one thing are executed in parallel and asynchronously. And so that variable will not be repeatedly updated as you might expect. Instead, each re-create of the variable is thrown away when that pass through the branch finishes.
Worse still for your scenario: the steps after the branch will start processing before the branch completes, as there is no guarantee of when such branches will complete, up until the last step of the rule.
The answer is similar to what @Marc - Devoteam suggests, but without using any branching:
Use the Lookup Objects action with your AQL expression, and then sum from the {{lookupObjects}} smart value.
Kind regards,
Bill
You will need, after the lookup objects, branch the rule, this to go over the list of found objects
And set a field (number), or variable with smart value e.g. {{lookupObjects.Amount.sum}}
I used this article as guidelin: https://support.atlassian.com/automation/kb/sum-a-custom-field-number-value-from-all-linked-issues/
Or maybe better, see this article: how-to-sum-up-attributes-value-of-multiple-assets-in-an-objects-custom-field-and-update-it-to-another-jira-field-using-automation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your feedback. Unfortunately, I am not able to get this to work.
I also tried some alternative setup, which also doesn't seem to return the total.
Any thoughts on what i might be doing wrong ?
Best regards,
Kris
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.