Automation: variable outside branch

Dirk Aerts January 2, 2025

Dear all

As Jira Product Discovery has no hierarchy (yet), I used the work-around with using a field to 'group' ideas under a virtual parent. As stated in this video.

Now I would like to update the virtual parent of the ideas with the sum of the children.

In automation I managed to retrieve the sum of the children and store it in a variable. However this variable is unknown outside the branch. I manage to retrieve the parent, however I can not update it with the variable, as it does not recognize it.

Has someone a solution or another approach to achieve this?

Many thanks


automation rule.png

3 answers

2 accepted

2 votes
Answer accepted
Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 2, 2025

Hi @Dirk Aerts ,

Everything that you do in a branch will be executed in different processes ('threads'), this means that you don't know when a branch is finished.

It can be that some branch processes are still running while your second lookup is executed.

With this in mind, I've two questions for your:

  1. In the lookups are you certain that you have less than 50 issues that can be found?
  2. The sum of a certain field van be retrieved by {{lookupIssues.FIELDNAME.sum}}, are you using that?

 

Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 2, 2025

Or maybe a better question is: can you show the details of the different actions, like the varSum and the edit issue for 'ETC (sum)'?

0 votes
Answer accepted
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.
January 2, 2025

Hi @Dirk Aerts 

JPD recently added some features for issue hierarchies; please see this article to learn more: https://community.atlassian.com/t5/Jira-Product-Discovery-articles/A-giant-update-for-hierarchies-issue-types-opportunity-solution/ba-p/2893631

 

As @Rudy Holtkamp describes, automation branches which could be on more-than-one-thing are executed in parallel and asynchronously, and so any variables created inside are not available outside the branch or on each pass through the branch.

If you are only summing, averaging, calculated values from the results of a lookup issues action, that can be done directly, as shown here in an example to sum Story Points: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--lookupIssues--

For more sophisticated calculations, list iterations and math operations can be combined.  You can get an idea of that with this other way to sum the product of two custom fields:

{{#=}}0{{#lookupIssues}} + ( {{MyCustomFieldA|0}} * {{MyCustomFieldB|0}} ) {{/}}{{/}}

 

Finally, I observe your rule is making multiple Lookup Issues calls with similar JQL, differing in only one field.  To make your rule faster, you could use smart value, list filtering with only a single lookup: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

 

Kind regards,
Bill

0 votes
Dirk Aerts January 2, 2025

@Bill Sheboy @Rudy Holtkamp 

I managed to do it with one lookup (all issues) and branch (issue to update), and then the calculations (sum, average) on the lookup issues in the edit action.

{{lookupIssues.field.sum}}

 

Many thanks both for your support! Folded Hands Emoji (U+1F64F)

Suggest an answer

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

Atlassian Community Events