Jira automation email - conditional logic "or" / "and" does not work

Nicolay Subbota August 6, 2022

Hi!

I try to configure some conditions based on "or" and "and" logic, but looks like it does not work.

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

My example: 


Total created issues: {{lookupIssues.size}}

{{#lookupIssues}}
• {{key}} {{summary}} by

{{#if(or(reporter.displayName.equals("Nico"),reporter.displayName.equals("Alex"),reporter.displayName.equals("Dmitry"),reporter.displayName.equals("John")))}}
11<b>{{reporter.displayName}}</b>11
{{/}}

{{#if(and(not(reporter.displayName.equals("Nico")),not(reporter.displayName.equals("Alex")),not(reporter.displayName.equals("Dmitry")),not(reporter.displayName.equals("John"))))}}
55<b>{{reporter.displayName}}</b>55
{{/}}

{{#if(reporter.displayName.equals("Nico"))}}
121<b>{{reporter.displayName}}</b>121
{{/}}

({{url}})
{{/}}


 

And in this case, the first and second "if" block does not work, nothing is added to email.

But the third "if" block without logical "or"/"and" works correctly.

Could you suggest me?pico-nico.PNG

 

Thank you very much! 

1 answer

1 accepted

3 votes
Answer accepted
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 Leaders.
August 6, 2022

Hi @Nicolay Subbota -- Welcome to the Atlassian Community!

Thank you for your question: I believe you have discovered an ambiguity in the conditional logic documentation.

After a bit if testing it appears the documentation means that OR() and AND() can only have exactly two parameters: or( A, B).  I confirmed this by passing one value, and it failed in the same way, until I added a dummy parameter.  These functions are commonly understood to support chaining results, and so the documentation may be misunderstood.

So to make your use case work, change your rule to use nested OR() or AND() statements, such as this, where I grouped your first two conditions inside of another OR()

{{#if(or(or(reporter.displayName.equals("Nico"),reporter.displayName.equals("Alex")),or(reporter.displayName.equals("Dmitry"),reporter.displayName.equals("John"))))}}
11<b>{{reporter.displayName}}</b>11
{{/}}

I will post this information in the article on conditional list filtering to help others: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Kind regards,
Bill

Nicolay Subbota August 6, 2022

Yes, that is perfect! Works like a charm. Thank you!

Like # people like this

Suggest an answer

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

Atlassian Community Events