IF statement in email automation

LRobinson March 21, 2024

I would like to create two separate lists, one for one status ("Executed") and one for another ("No trades")  but I can't get the if statements to work... help please!

current code (using HTML too):

{{#if(equals(status,"EXECUTED"))}} {{#lookupIssues}} {{summary}} <br>
{{/}}{{/}}

{{#if(equals(status,"NO TRADES"))}} {{#lookupIssues}} {{summary}} <br>
{{/}}{{/}}Picture1.png

2 answers

1 accepted

2 votes
Answer accepted
Kalyan Sattaluri
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.
March 21, 2024

Hello @LRobinson 

We need more info about your set up and requirement and what you have done so far.

What you have posted as the If condition is not helping as I am stuck between deciphering why is there {{#status}} and the syntax errors.

so help us help you by sharing details on what you are trying to do including screenshots.

LRobinson March 21, 2024

Hello, thanks for your comment. I have updated the question with better syntax and a screenshot, still not working.

What i would like is a list of issues, separated by status ie

if we have : Issue 1 with status 1

Issue 2 with status 2

Issue 3 with status 1

Issue 4 with status 2

 

--> 

Issue 1

Issue 3

 

Issue 2

Issue 4

 

so the ability to order/sort by status for an email output

Kalyan Sattaluri
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.
March 21, 2024

Please try below and if you are seeing the output, you can add additional fields after, but please note, you cannot sort the list within a condition..

 

{{#lookupIssues}}

{{#if(equals(status,"EXECUTED"))}} {{summary}}<br> {{/}}

{{/}}

 

{{#lookupIssues}}

{{#if(equals(status,"NO TRADES"))}} {{summary}} <br>{{/}}

{{/}}

LRobinson March 21, 2024

unfortunately still outputting blanks... just can't get the IF statement to work

Kalyan Sattaluri
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.
March 21, 2024

Hello @LRobinson 

Always a good idea to log smart values so you know you are checking the right thing in If condition. Please try below:

 

{{#lookupIssues}}
 
{{#if(equals(status.name,"EXECUTED"))}} {{summary}}<br> {{/}}
 
{{/}}
 
 
 
{{#lookupIssues}}
 
{{#if(equals(status.name,"NO TRADES"))}} {{summary}} <br>{{/}}
 
{{/}}
If above does not work, please log below smart value and share screenshot:
{{lookupIssues.status.name}}
LRobinson March 21, 2024

I simplified it massively..

{{if(equals(status.name."No trades"))}} {{lookupIssues.status.name}}<br>

 

which outputs the below, therefore the IF statement is not working at all

 

Picture2.png

Kalyan Sattaluri
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.
March 21, 2024

Hello @LRobinson 

You are complicating this, The lookup value is case sensitive, so it was not working before. Please try below:

 

{{#lookupIssues}}
 
{{#if(equals(status.name,"Executed"))}} {{summary}}<br> {{/}}
 
{{/}}
 
  
{{#lookupIssues}}
 
{{#if(equals(status.name,"No Trades"))}} {{summary}} <br>{{/}}
 
{{/}}
Like # people like this
LRobinson March 21, 2024

Amazing! it works! thank you!

Like Kalyan Sattaluri likes this
0 votes
Harsh
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.
March 21, 2024

Hi @LRobinson 

Welcome to the community.

Would like to if you are using JIRA automation for this email automation?

Thank you

LRobinson March 21, 2024

Hi yes, i have updated the question with a picture

Harsh
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.
March 21, 2024

Hi @LRobinson 

Instead of using the HTML you can directly use if else block with your choice of condition.

In the image after you issuetype condition - use inbuilt if/else block and there you can choose issue field condition, which will be a lot easier and user friendly when compared to HTML.

Thank you

LRobinson March 21, 2024

Hi, I'm not sure how I would write this?

 

{{#lookupIssues}} {{#if(status="executed",summary}} <br>
{{/}}{{/}}

{{#lookupIssues}} {{#if(status="no trades",summary}} <br>
{{/}}{{/}}

 

?

Suggest an answer

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

Atlassian Community Events