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

Smart value in published article doesn't work?

Edited

The example in a screenshot in this article showing how to check a string against a field's value (repeated below) does not work anymore. Did the team change the format? I can't find any documentation about this on the official site.

{{#if(eq(issue.issuetype.name, “Bug”))}} Content {{/}}

Additionally, in the same article it says that other basic conditionals are supported (equals, not, and, or) but I can't find any documentation on how to use this either. Any guidance would be greatly appreciated!

2 answers

1 accepted

1 vote
Answer accepted

Hi all,

An update on yesterday's issue.

I reached out to support and they sent me the following:

{{ #if(eq(issue.issuetype.name, "Task")) }} This is a task {{ / }}

Which to my surprise worked! I tried it formatted like the one from this article again to understand why:

{{#if(eq(issue.issuetype.name, "Task"))}}This is a task{{/}} 

And it once again did not work. Turns out, you MUST put a space in front of #if and the / in the closing mustache, like so:

{{ #if(eq(issue.issuetype.name, "Task"))}}This is a task{{ /}}

A bit strange because I haven't seen spacing like that affect the completion of a smart value, but hey, I'm glad I can use it now.

Thanks for uncovering that!  Did you suggest that they update the original article's images to reflect this difference?

And, one more thing to add to the documentation pages!  ;^)

Best regards,

Bill

I have stumbled upon the same problem and tried your solution. It is indeed executed, but all the time. It completely ignores the result.
For this rule:

{{ #if(eq(priority.name, "Critical"))}}
<u>{{priority.name.toUpperCase()}} 1</u><br>
{{ /}}

{{ #if(eq(priority.name, "Major"))}}
{{priority.name}} 2<br>
{{ /}}

I got this output for a single bug:

MAJOR 1
Major 2 

 Are there any additional guides or examples to check?

Like Brock Jolet likes this

Hi @pavlova_iryna 

Back in November 2020 when I last tried this feature, it worked as suggested by support, and apparently no longer works that way in my site instance either.  I suggest asking your site admin to submit a support ticket for this issue here: https://support.atlassian.com/contact/#/

I did several tests for text and numeric fields, with and without spacing (leading/trailing) for the #if syntax...and with the eq() and issue.field.eq() syntaxes.  The only accurate and predicatable results I saw were for numeric fields with this syntax:

{{#if(issue.Story Points.eq(5))}}The Story Points are 5{{/}}

I was unable to get text fields to work for the tests.  Perhaps the syntax has changed again and the documentation has not caught up yet.  Atlassian Support should be able to confirm for you.

Best regards,

Bill

Hi @Massis Shahmirian 

I agree that article may be incorrect, as the #if operator only seems to work for numeric values and not string/text ones.  You can infer that looking at the documentation for math versus text smart value functions:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/

https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-manipulate-text-strings/

I saw your comment on that article, so let's see what the author says.  :^)

Of note, your quotation marks appear to be the angled-type (from a human-readable document) rather than the generic ones used in code like smart values.

Anyway... what problem are you trying to solve?  For example, if you are making conditional content for an email (like that article tries to do), have you instead tried using Create Variable and If/Else to build up your message pieces?

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Automation

New to Jira Automation - goodbye Cron (sort of), hello new project created trigger, new additions to

Hey Everyone! Simeon from the Automation team here. I'm delighted to share some new features and improvements that we are shipping to Jira automation (Cloud only). Firstly, @Sam Harding&nbsp...

2,879 views 10 23
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