The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Smart variables rendering #if

Fede B.
Contributor
July 19, 2024

Hi,

 

I wrote this smart variable in an automation rule:

myVar = 

{{#issue}}{{#if(equals(status.statuscategory.name,"Done"))}}found value{{/}}{{status.statuscategory.name}}{{/}}

 

When I print it into a log (or use it), on an issue with status category Done, the returned value is always (just) "Done". "found value" is never printed.

The above example is just a simplified version of what I'm doing (though I tested exactly the above example before writing this question, just in case); still, I've tested that this simple usage of if-equals is never working as I'd expect, and I'm wondering what I'm doing wrong.

My goal in the end is to write a variable in the form of an if-then-else structure:

myVar = {{#if(equals(somefield,"yes"))}}0{{/}}{{#if(not(equals(somefield,"yes")))}}1{{/}}

, for instance.

In this way, I may avoid using a lot of if-else branches, that consume my rule 'space' very quickly.

 

Best regards

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Alex Koxaras -Relational-
Community Champion
July 19, 2024

Hi @Fede B. 

This smart value:

{{#if(equals(status.statuscategory.name,"Done"))}}found value{{/}}

works as expected. If any issue is on Done status it will yield "found value".

What is it that you want to achieve by adding {{#issue}}. Which list do you want to iterate with?

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events