# {{#if}} conditions in Jira Automation: syntax and examples

URL: https://goingstellar.ro/reference/smart-values/if/

{{#if(condition)}}text{{/}} prints the text only when the condition is true. The function form if(condition, a, b) picks between two values. Conditions are usually a comparison, exists(), equals(), a boolean function such as contains(), or a combination with and(), or() and not().

## Syntax

```
{{#if(condition)}}text{{/}}
{{if(condition, "value if true", "value if false")}}
```

## Arguments

- `condition` (required: yes): A check that returns true or false, such as a comparison, exists(), equals() or contains()

## Works on

- Blocks: any text between {{#if()}} and {{/}}, including other smart values
- Returns: the text or value when true, otherwise an empty string

## Examples

```
{{#if(not(issue.labels.isEmpty))}}Labels: {{issue.labels.join(", ")}}{{/}}
```

Print the label list only when the work item has labels.

Result:

```
Labels: checkout, demo
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#if(issue.description.contains("wrong"))}}Mentions a wrong total{{/}}
```

Add a note when the description contains a word.

Result:

```
Mentions a wrong total
```

Run on Jira Cloud on 29 Nov 2026.

```
{{#if(not(issue.issuelinks.isEmpty))}}This bug has {{issue.issuelinks.size}} related tickets{{/}}
```

The conditional comment from the docs as one line; with no links nothing is printed.

Run on Jira Cloud on 29 Nov 2026.

```
{{if(issue.Votes, "Has votes", "No votes")}}
```

The function form with an else value.

Result:

```
No votes
```

Run on Jira Cloud on 29 Nov 2026.

```
{{if(exists(issue.duedate), issue.duedate.format("dd/MM/yyyy"), "No due date")}}
```

Choose between a formatted date and a fallback text.

Result:

```
15/12/2026
```

Run on Jira Cloud on 29 Nov 2026.

## Where the documentation differs

- `{{if(issue.summary)}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `The docs say {{if(smartValue)}} returns true or null.`, the actual result is ``.
- `{{if(issue.summary, "Hello")}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `The docs say {{if(smartValue, "Hello")}} returns Hello or null.`, the actual result is ``.
- `{{if(issue.summary)}}Hello{{/}}`: run on Jira Cloud, 29 Nov 2026: the documentation says `The docs say {{if(smartValue)}}Hello{{/}} returns Hello or null.`, the actual result is `Error parsing template: Mismatched start/end tags: null !=  in template-f5b1359e-924b-4e4d-be3b-d48fd44aaf2e:1`.

## Pitfalls

- The block form needs the hash: `{{if(issue.summary)}}Hello{{/}}` without it is rejected on save, although the docs write it that way (checked on Jira Cloud, November 2026).
- The condition has to be a true or false value. `{{#if(issue.summary)}}Hello{{/}}` printed nothing on a work item with a summary, and `{{if(issue.assignee, "Assigned", "Unassigned")}}` printed Unassigned on an assigned work item. Use `exists()` or a comparison (checked on Jira Cloud, November 2026).

## Related

- [equals() and exists() in conditions](https://goingstellar.ro/reference/smart-values/conditional-equals-exists/)
- [and(), or(), not()](https://goingstellar.ro/reference/smart-values/and-or-not/)
- [gt(), gte(), eq(), lt(), lte()](https://goingstellar.ro/reference/smart-values/number-comparisons/)
- [Default values {{value|default}}](https://goingstellar.ro/reference/smart-values/default-values/)
- [{{#=}} math expressions](https://goingstellar.ro/reference/smart-values/math-expressions/)

## Sources

- [Jira smart values: conditional logic (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/)

