Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Smart value in published article doesn't work?

MS
Contributor
November 21, 2020

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
MS
Contributor
November 23, 2020

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.

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.
November 23, 2020

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

pavlova_iryna April 9, 2021

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
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.
April 9, 2021

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

0 votes
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.
November 23, 2020

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
AUG Leaders

Atlassian Community Events