Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Multiple IF statements that are not mutually exclusive

Hi,

I have created a checkbox customfield where multiple options can be selected. I have tried to create an automation rule that checks for each options if it is selected, and if so creates a specific issue (see below). 

Now In the below example, if I select both 'UK' and 'ES' cultures, both issues are created. But if I only select the second option (ES), nothing happens as the automation does not get past the first validation. It must be because these IF statements are actually nested and not validated separately. If it doesn't pass the first IF, the second is never reached. This forces me to create separate automation rules per culture. Is there anything that I can do to perform this automation in a single rule?

Mutliple IF statements.png

2 answers

Hi, @Ivo_de_Vries -

I just encountered a similar issue while working for a customer.  My co-workers and I figured out that if you embed each separate If statement in a Branch, they will all be validated separately.  Here's what we came up with:

Multiple_Ifs.JPG

I hope that helps you (belatedly).

This is perfect!  This worked for me, and I believe this would help the OP in the situation they were having.  This solution should be at the top.

Thanks @David VanDyke that helped me

Hi Ivo,

I'm Ilenice, from Automation for JIRA Support team.

Thanks for your question!

Well, what is happening to your rule is that, since “ES” option is selected, the first JQL condition doesn’t match, and then the rule stops executing, not even checking the next condition.

To your use case, I would suggest you use an IF/ELSE block condition:

IfElseCondition.png

You can configure your two JQL conditions inside this IF/ELSE block condition. I’ll show you how.

Please set your rule using the structure described below:

  • TRIGGER - When issue transitioned;
  • CONDITION: IF/ELSE BLOCK
    1. IF BLOCK
      • JQL Condition, setting the expression issuetype = "Communication Request" AND "Type of Communication" = "Urgent communication" AND Cultures = UK
      • CREATE ISSUE action
    2. ELSE BLOCK
      • JQL Condition, setting the expression issuetype = "Communication Request" AND "Type of Communication" = "Urgent communication" AND Cultures = ES
      • CREATE ISSUE action

It’ll look like the following:

18725_ExampleRule.png

 

So, please note that when using an IF/ELSE block condition, if the first condition doesn’t match, Automation will check the next condition. :)

I hope it helps!

Let me know if there is anything else I can help with.

Cheers,

Ilenice

Hi Ilenice,

Thanks for your elaborate and quick answer. This also is not a solution for the current use case as the IFs are not mutually exclusive, I will explain a bit more on the context and the current (not ideal) workaround I have for it.

Our company serves about 18 countries and whenever we send out a communication, an issue of this type is created first. Whilst creating the issue, the cultures are selected that the communication applies to. Per culture that is selected, I want to generate a ticket for that specific department to handle the translation and sending of the communication. On the creation screen, the reporter also selects one of the predefined 'e-mail templates'. 

Ideally, I would like to create a single automation rule per e-mail template, with an IF for every culture. IF checkbox culture is selected for UK, ES, NL and FR, the automation rule should create 4 issues respectively for each country. Using multiple IF's or an IF/Else structure does currently not work as explained above. 

I would like to have a single automation rule per e-mail template as it is much more efficient to copy a rule for a new template (with all the IFs per culture) each time we introduce a new one (and make small adjustments to it). Currently my workaround is not to create automation rules per template but per culture (18 rules). Every time a new template will be added, I will have to add another IF statement to each of the 18 rules.

Hi Ivo,

thanks for replying and I’m sorry for my late response.

I’ve discussed this point with the dev team and, unfortunately, at the moment it’s not possible to achieve the result you want at the moment. For now, it indeed demands you to configure the 18 conditions, that is, one condition to each country available on the checkbox field. 

However, through AUT-81 https://codebarrel.atlassian.net/browse/AUT-81 (You may need to open in an incognito window) we’ve been tracking an improvement which could help you on this, so we might have good news in the future. :)

In case you have any other questions or doubts, please feel free to make a new contact.

Cheers,

Ilenice

Like Ivo_de_Vries likes this

Hello

Do you know why i cant see if-else block while adding new component condition in Branch rule in second screen shot with red pen?

thanks
Milan


sc-1 with if-else block.PNGsc-1 without if-else block.PNG

Hi, @Milan Ardeshana!

Yes, you're right, this is indeed not available. :(

By now, it was restricted to prevent performance issues.

There's an AUT raised for this, through which this point is being tracked: https://codebarrel.atlassian.net/browse/AUT-1005 - you might need to open this on incognito.

Let me know if there is anything else I can help with.

Cheers,

Ilenice

Like Milan Ardeshana likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

175 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you