Smart value in published article doesn't work?
Asked by MS:

The example in a screenshot in [this article](https://community.atlassian.com/t5/Automation-articles/New-automation-smart-values-in-Jira-Cloud/ba-p/1402775) 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!


Answers:
author: MS
body: 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.

comments: author: Bill Sheboy
body: 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


author: pavlova_iryna
body: 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?


author: Bill Sheboy
body: Hi [@pavlova_iryna](/t5/user/viewprofilepage/user-id/1097599)

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


author: Bill Sheboy
body: Hi [@Massis Shahmirian](/t5/user/viewprofilepage/user-id/4015549)

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