Automation for Jira - When adding a new rule the logic defaults to AND how do i add IF ELSE logic?

Anthony Martin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 16, 2017

When trying to create a new rule using a "user condition"

The logic only allows for AND statements, so all conditions must be true, but I need to be able to use IF, ELSE type statements in this automation. Will this work?

 

If not, what is the supported way of using this kind of logic structure?

 

Thanks

 

3 answers

3 votes
Manny Delarosa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2023

Jira does not support nested if/then statements within a single branch of automation rules. For example, you cannot have a structure like this:

  • Branch
    • If [Condition A]
      • [Action A]
    • Else If [Condition B]
      • [Action B]

To work around this limitation, you can create multiple branches, each with one condition that effectively functions as part of the "if/then" logic. The structure would look like this:

  • Branch
    • If [Condition A]
      • [Action A]
  • Branch
    • If [Condition B] (which is the 'else' part of the first condition)
      • [Action B]

This workaround achieves the same result as the unsupported nested structure. The only downside is that the automation rule may have to execute multiple passes, one for each branch, which could impact the automation rule performance depending on the complexity and number of conditions/actions.

 

Hope this helps!

3 votes
Moheeb Qupty June 20, 2021

Seem this still not available using "If-Else" block in Branch, which surprising why it's not implemented what the harm to have this normal if/else conditions!

 

Anyway, question to @andreas  what is the workaround that works in a lot of cases you mentioned earlier?

The following link doesn't work:

https://docs.automationforjira.com/components/conditions/conditions.html#if-else-block

1 vote
andreas
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.
June 19, 2017

Hi Anthony,

Sorry for the slow response on this.  We don't fully support this yet (see https://codebarrel.atlassian.net/browse/AUT-42), but there is a workaround that works in a lot of cases.  

EDIT: This is now available - see https://docs.automationforjira.com/components/conditions/conditions.html#if-else-block

Cheers,
  Andreas

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 30, 2020

The If-Else block does not appear to be available within a branch. Disappointing.

 

 

Screen Shot 2020-01-30 at 1.02.01 PM.png

Like # people like this
Luanna Gobbato
Contributor
March 27, 2020

@Trudy Claspill I was stuck with this too, but I did the if condition outside the branch stuff. In my case, it worked, I just changed my logic. 

Cédric Cox
Contributor
October 21, 2020

Hi everybody, where are we with this feature? It is said it is implemented, but I can't see it.

Like # people like this
Diego Llarrull
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2021

Any updates on this? 

David Arturo Cruz Salinas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 28, 2023

2023 and we still can't use if/else inside a branch

Is atlassian still working on Jira?

Like # people like this
Sanjay Naidu April 11, 2023

Work Around for this issue using Web hooks

In my case, whenever Epic's Due Date was modified I had to recalculate the dates for all of its children and calculation logic varied based on the Summary of the Child Issue present. 

having if/else on Branching option to run the date calculation based on if, else would be best option, but since it is not there. I have used following approach.

Step 1 - Setup a trigger on the parent/epic that will call a web hook and pass the Issue Key to the service.

Step 2 - Setup an incoming web hook with setting ► "Issues provided by running the following JQL search" and now use the smart value to generate the JQL like below 

issuefunction in issuesInEpics("key={{webhookdata.key}}")

Now you can add IF/Else without a branch option and every issue from the JQL will iterate through it and control can be sent back to the calling service if required.

 

outgoing side

Annotation2 2023-04-11 140918.png

 

Incoming Side

Annotation 2023-04-11 140918.png

Like Nenad Micic likes this
Nenad Micic
Contributor
October 14, 2024

Like what you did here!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events