'If equals' operation using Smart Values in Jira Automation

Oscar Readwin December 9, 2022

I'm looking to add an 'if equals' operation into one of my global automation rules - the idea being that, depending on the value of our Smart Value (customField_10129), the inline styling on the HTML table contents of the automated email sent out will change.

 

I have followed the syntax defined in this article about conditional logic, however it does not work correctly. The following always returns what should be the conditional value of 'red' (this should only happen when the text for customField_10129 equals "Serious"):

<td style="background-color: {{#if(equals(customField_10129, "Serious"))}}red{{/}} </td>

 

I've done some further testing and it appears that these if statements do not work correctly at all, as the following also returns true/'red' when it shouldn't:

<td style="background-color: {{ #if( equals("A", "B")) }}red{{ / }};">{{customField_10129}}</td>

 

Any advice/help on this would be greatly appreciated.

1 answer

1 accepted

3 votes
Answer accepted
Luis Machado
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2022

Hi @Oscar Readwin 

Welcome to the Community!

Try this:

{{#if(equals(customfield_10129.value, "Serious"))}}red{{/}}

The conditional logic worked for me by itself at least. I would test it standalone first in a log action to verify and then try it in your message.

Oscar Readwin December 15, 2022

This has worked for me, thank you very much!

The missing puzzle piece seems to be '.value'

Kaysaff Tal April 15, 2023

@Luis Machado Maybe u can help me with a simmilar issue, i assume it is the variable encoding or something

Web response is Successful.

 

this statement:

{{#webResponse.body.values}}{{if(equals("SAT Sprint 2", name),id)}}{{/}} is true

 

 

And this statement

{{#webResponse.body.values}}{{if(equals(test, name),id)}}{{/}}

where test = SAT Sprint 2 fails

image.png

Greg McNamara October 10, 2023

Hi @Kaysaff Tal did you ever manage to resolve using custom variables in conditional logic (as you were trying to do above)?

Kaysaff Tal November 22, 2023

@Greg McNamara 

Sorry for the late response..didnt see this

Yes I did, with a few automation steps

Yatish Madhav
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.
January 17, 2024

Thanks @Luis Machado this answer has helped me

Like Luis Machado likes this

Suggest an answer

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

Atlassian Community Events