Forums

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

Rearrange IF block within Jira automation

Steve Ungar
Contributor
February 9, 2023

I have a Jira automation that has quite a few else's within an If/Else block.  Occasionally there's a field that doesn't get populated so one of the calculations within it throws an error.  I'd like to wrap the entire existing If/Else under a new If/Else that has a check for the value being missing:

IF <value> not empty, THEN <all existing code> ELSE <do something else>

I can add the new If/Else, but when I try to drag the existing If/Else block under the new one, it won't let me.  I can drag and drop each individual Then block, but would need to recreate all the If logic through copy/paste plus individually drag all the actions under the right Else/If section.  Pain in the behind!

Is there a way to add the new If/Else block and move all the existing logic under it without recreating it?

Alternatively if there's a way to exit the automation under a condition (IF <value> is empty then exit) that would work, but not ideal.

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Champion
February 9, 2023

Hello @Steve Ungar 

In Jira Cloud nesting an If under an If is not supported. I suspect it is not supported in Automation for Jira Server/DC either.

You could add a Issue Field Condition to check if the field is empty before starting your If/Else-if section.

Or you could make the first IF checking to see that the field is not empty.

Or you could add a second condition to each If/Else-if component to verify that the field is not empty.

Steve Ungar
Contributor
February 10, 2023

I want to avoid the last option because of the number of Elses that would need to be changed.  Maintenance nightmare!

I tried to add a first IF to check if the field is empty but had the same issue - I couldn't get all the other logic to switch to move under the new Else that would be created.  But I guess rebuilding the first IF statement as an Else-If isn't too bad.  Thanks.  

Syed Fazeem
Contributor
August 26, 2023

HI @Steve Ungar ,

 

We are in Need of If/Else block - same thing as below flow.

 

If 

then

else if

then

else if

then

Sylvie Bracke February 14, 2024

I have the same question. I have a complicated nested IF.  But now I need to insert 1 IF in the middele of the nested IF's. But I can not find how to do it. 

Suggest an answer

Log in or Sign up to answer