I have an automation rule with embeded "If-else" conditions within "If" conditions.
I expect the "if-else "conditions to be exclusive (if one is met, then the rest is not evaluated).
I expect the "If" conditions to be inclusive (even if the first "if" is met, the rest of the "If" is evaluated). Likewise, when the first "If" is not met, then the second "If" should be evaluated.
Below the image of most of my rule. When the rule is executed, it evaluates the first "if "(red arrow) and if it is met, it evaluates the "if-else". However it never actually gets to evaluate the second "if" (2nd red arrow).
Any ideas why?
The original post said:
I have an automation rule with embeded "If-else" conditions within "If" conditions.
Actually, the rule you posted has a series of IF and IF-ELSE conditions. No conditions are "embedded" or nested. Jira Automation, to my knowledge, cannot nest conditions (although conditions may be used inside a branch).
Your rule is a linear series of steps. Regarding conditions:
Hope that helps!
Thanks for your reply Mykenna. That makes it clearer.
I tried using the brach, but it won't allow if-else conditions.
I need a rule with 2 levels of if-else conditions.
Is there any way to achieve that with automation?
Something like this:
If Field_1 is A then
change_1.a
If Field_1.1 is A.1 then
change_1.a1
else if Field_1.1 is A.2 then
change_1.a2
else
change_1.a3
else if Field_1 is B then
change_1.b
If Field_1.1 is B.1 then
change_1.b1
else if Field_1.1 is B.2 then
change_1.b2
else
change_1.b3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can achieve this in automation another way. (This is where my 20+ years as a software developer comes in handy...)
You can replace nested IF-THEN-ELSE conditions with a single IF-THEN-ELSE by adjusting the conditions appropriately. I've converted what you posted above to illustrate how to do that:
If (Field_1 is A) and (Field_1.1 is A.1) then
change_1.a1
else if (Field_1 is A) and (Field_1.1 is A.2) then
change_1.a2
else if (Field_1 is A) and (Field_1.1 is not A.1) and (Field_1.1 is not A.2) then
change_1.a
else if (Field_1 is B) and (Field_1.1 is B.1) then
change_1.b1
else if (Field_1 is B) and (Field_1.1 is B.2) then
change_1.b2
else if (Field_1 is B) and (Field_1.1 is not B.1) and (Field_1.1 is not B.2) then
change_1.b
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Iana,
Automation is designed so that, if a condition fails, no actions following it will be performed. The "if/else" condition is actually an exception: if a condition fails, then we go to the next "else", then to the next one, and so on.
Hope this helps!
- Manon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The second will not be evaluated, that is how it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If any condition fails Automation will stop at that point!! Better use branching to separate the checks here for your requirement
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.