Forums

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

If/Else Condition

Timi Falusi
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!
January 21, 2026

How do I make the if condition attached into an else condition under the same branch?Screenshot 2026-01-21 130417.png

2 answers

3 votes
Mikael Sandberg
Community Champion
January 21, 2026

You cannot add IF/ELSE condition within a branch, at least not yet. What type of branch are you using?

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 Champions.
January 21, 2026

Hi @Timi Falusi 

Yes, and...to the suggestion from @Mikael Sandberg 

As Mikael noted, an if / else condition cannot be used inside of a branch (although the opposite is possible). 

Perhaps if you describe the problem your rule is solving (i.e., why do this) and post an image of your complete rule, that will help the community offer better suggestions including alternative rule structures.  Thanks!

Kind regards,
Bill

Like # people like this
Timi Falusi
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!
January 22, 2026

Screenshot 2026-01-22 100852.pngScreenshot 2026-01-22 100900.png

This is what I have in full. I want it to add labels OT and US if a ticket is created between 17:00 and 22:00 UTC, else add labels OT and APAC if a ticket is created between 22:00 UTC and 8:00 UTC

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 Champions.
January 22, 2026

Thanks for those images and the explanation of the rule.

As you are running this daily with JQL to find work items created within specific time ranges, you could use a couple of alternative approaches:

  1. Extract the hour for the Created date / time using date time functions, and then use a Lookup Table or conditional expression to select the desired label, etc.
  2. Using dynamic JQL on Created date /time ( relative to {{now}} ), first identify work items within one time range with your Send Web Request action, handle those, and then repeat the steps for the other hour range.

The first approach is simpler and less likely to have errors halt the rule.

 

I have a couple of follow-up questions:

Why are you using the work item search endpoint with Send Web Request rather than the Lookup Work Items action and a basic JQL branch and then performing a work item edit?  For the edit, is it just to suppress any notifications?

And, given the limitations of automation rules and the REST API endpoints, your rule can only process a limited number of work items.  Will the JQL you are using ever return more work items than the service limits? https://support.atlassian.com/cloud-automation/docs/automation-service-limits/

 

Timi Falusi
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!
January 22, 2026

Yes, I am using it daily with a JQL to get tickets created in a specific project with the label "Code Red". Could you give me a visual representation of what you see mean here "

  1. Extract the hour for the Created date / time using date time functions, and then use a Lookup Table or conditional expression to select the desired label, etc."

I’m using the search REST endpoints via Send web request so I can first call approximate-count (to skip work when there are no matches) and then fully control the JQL and returned fields.

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 Champions.
January 22, 2026

First thing: as you are are already using the date / time functions, I recommend pausing to learn more about the other available functions.  For example, to get the current hour as a number from 0 to 23, use the format("H") function:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---

Under that function, it has a link to the additional Java documentation for formats such as for hours.

 

If your test is regardless of the day of week, you could use a conditional expression to find the correct labels needed based upon that hour value, 0-23:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

 

If instead you have working / non-working days and hours, you would need to first check the day of week and then the hours.

0 votes
Trudy Claspill
Community Champion
January 21, 2026

Hello @Timi Falusi 

Welcome to the Atlassian community.

Please provide a screen image that shows your entire rule so we have appropriate context for your question.

Also explain to us what you are trying to accomplish with the rule.

Is the image you showed us nested under a For Each branch? i.e.

Screenshot 2026-01-21 at 11.59.57 AM.png

@Mikael Sandberg is correct that if you have a rule structured as above you cannot incorporate an If/Else block within a branch. But if you are not actually in a For Each branch, then to add and If/Else block to the rule you need to select that option when you are adding your condition.

Screenshot 2026-01-21 at 12.03.09 PM.png

 

You can't add an Else when you have selected a simple If condition.

After selecting an IF or ELSE condition then you will see that there is a button for adding the Else.

Screenshot 2026-01-21 at 12.04.05 PM.png

Timi Falusi
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!
January 22, 2026

Screenshot 2026-01-22 100852.pngScreenshot 2026-01-22 100900.png

This is what I have in full. I want it to add labels OT and US if a ticket is created between 17:00 and 22:00 UTC, else add labels OT and APAC if a ticket is created between 22:00 UTC and 8:00 UTC

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events