Forums

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

Multiple if conditions are not working in foreach in Automation

Jamshaid
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.
October 13, 2024

I have added two conditions inside a foreach loop but from the logs, it looks like it is only executing the first condition and then the loop exits somehow or I don't know what's going on after that. 

Here is my tree that executes on the update issue

Screenshot from 2024-10-14 05-19-07.png

Here are my logs

Screenshot from 2024-10-14 05-20-26.png

 

I am not able to find any potential issue in this. I have also tried the second condition with just the value CT79 and without using trim in the first part of the condition but none works. if I put it as first condition, it then works. It looks like the second condition is not checked after the first condition. I am not getting any idea how it goes.

Thanks

2 answers

1 accepted

4 votes
Answer accepted
John Funk
Community Champion
October 13, 2024

Hi Ramshaid,

Yes, the If conditions under a branch are not If/Else conditions so if the first condition fails then the rule will stop.

And you can’t put If/Else conditions under a branch. So maybe try multiple branches with the different condition under each branch.

Jamshaid
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.
October 13, 2024

Thanks, @John Funk, for clarifying the point. Could you please point me to some references on how to use branches? I will be dealing with multiple automation processes, and I don't want to keep asking questions here.

 

 

John Funk
Community Champion
October 13, 2024

Just use them are you are doing now. Just add a new branch below the current branch and move the second condition and action down under it.

Like • Ashok Shembde likes this
Jamshaid
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.
October 13, 2024

@John Funk Thanks. I got it working.

Like • John Funk likes this
John Funk
Community Champion
October 14, 2024

Great! Glad to hear. 

0 votes
YY Brother
Community Champion
October 13, 2024 edited

Hi @Jamshaid 

Could you have a try if-else if?

YY Bro 

Jamshaid
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.
October 13, 2024

Hi @YY Brother 

I don't find any option for if-else in my structure.

 

Suggest an answer

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

Atlassian Community Events