Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation rule : Make sum of object attribute

Kris Dewachter
Community Champion
April 15, 2025

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.

 

Screenshot 2025-04-15 at 14.04.51.png

Screenshot 2025-04-15 at 14.05.20.png

Screenshot 2025-04-15 at 14.06.44.png

 

Best regards,

Kris

 

2 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2025

Hi @Kris Dewachter 

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.

  • trigger: scheduled
  • action: lookup objects with your AQL
  • action: something that uses your sum value...

 

Kind regards,
Bill

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2025

Hi @Kris Dewachter 

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 

Kris Dewachter
Community Champion
April 16, 2025

Hi @Marc - Devoteam

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.

Screenshot 2025-04-16 at 10.14.22.png

 

Screenshot 2025-04-16 at 10.14.57.png

 

Any thoughts on what i might be doing wrong ?

Best regards,

Kris

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events