Forums

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

Ordering of if/else blocks in a single rule

nbarnwell January 14, 2025

I have a rule as follows: 

Jira automation rule.png

What I have found is that even when I have the text "D1" in my description before manually invoking the rule, the correct comment is not added. The audit log confirms that it was present.

I'm assuming this is because all the "if/else" rules run concurrently, thus are open to race conditions? This means the add-command at the end runs before the smart variable is set by the first if/else

Is there a way around this?

1 answer

1 vote
Trudy Claspill
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 14, 2025

Hello @nbarnwell

The structure of your rule does not match your requirement.

You have two independent IF conditions at the beginning. With independent IF conditions, the first time the rule encounters a failure of the condition it will stop processing.

Your first IF condition passes and creates a variable. The second IF condition fails, so the rule stops running. It never gets to the IF/ELSE structure after that

Another thing to note is that your variable ceases to exist after the IF branch concludes. The variable you are creating in the first two IF conditions will not exist when the IF/Else branch that creates the comment executes.

Instead you need to use a single IF/Else structure without any variable.

IF Description contains D1
THEN create comment (if that is what you want to happen)
ELSE IF Description contains D2
THEN create comment (if that is what you want to happen)
ELSE
do nothing if no comment should be added in this case.

Suggest an answer

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

Atlassian Community Events