Forums

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

JIRA Automation (Cloud). How to increment a smart variable.

Tom Gross August 21, 2023

I trying to add a comment to a main issue with the number of SubTasks that I just processed in a SubTasks loop.  I create a ProcessedSubTasks variable but can't seem to figure out how to increment the variable and display.  Is it an EditIssue action?  Something else?

2 answers

0 votes
Kian Stack Mumo Systems
Community Champion
August 21, 2023

@Tom Gross

I did think that there was a way to increment a variable by creating one inside of the branching with the same name as a variable created outside of the branching, but I am having trouble getting that to work.

I'll look into it a little bit more.

 

Thanks,

Kian

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.
August 21, 2023

Hi @Kian Stack Mumo Systems 

I believe that is only possible for a branch on one-and-only-one-item (e.g., Current Issue, On Parent, etc.)

The reason is that all the other branches get run in parallel, and although the created variable from before the branch can be referenced / re-created, the value goes out of scope and starts over with each loop.  Please look here for more information on that branching behavior: https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/#Ordering-of-branch-executions

I have seen cases of using the counter to drive an advanced branch, and when the issues are then created inside of the branch the counter can be used...they are just not necessarily created in order.  The technique does not work to update existing issues because nested branches are not possible.

Kind regards,
Bill

Like # people like this
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.
August 21, 2023

Hi @Tom Gross -- Welcome to the Atlassian Community!

For a question like this, please consider posting images of your complete rule, the details of actions / conditions / branches, and of the audit log details showing the rule execution.  Those will provide context for the community to offer suggestions.  Thanks!

Without seeing those things...

Created Variables in rules can be created, not updated.  There is an edge case where if you re-create a variable with the same name, you replace it.

However you seem to be describing using a branch over multiple things (e.g., issues, values, etc.)  In that case, the branch will process asynchronously and in parallel.  And the branch is not guaranteed to finish until the last point in the rule.  What this means is that even if you update a variable, the value inside of the branch has no meaning after the branch (as it was repeatedly created/destroyed).

If you post images for your rule perhaps a work-around can be identified.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events