# List size and isEmpty in Jira Automation: examples

URL: https://goingstellar.ro/reference/smart-values/list-size-isempty/

size returns the number of items in a list and isEmpty returns true or false. Use them to guard a message that only makes sense when links, comments or labels exist.

## Syntax

```
{{list.size}}
{{list.isEmpty}}
```

## Works on

- Fields: any list, such as issue.labels, issue.comments, issue.issuelinks or the result of split().
- Returns: a number for size, true or false for isEmpty. Both also work with parentheses.

## Examples

```
{{issue.labels.size}}
```

Count the labels on the work item.

Result:

```
2
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.split(" ").size}}
```

Count the words of the summary by splitting it first.

Result:

```
2
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.issuelinks.isEmpty}}
```

Test whether the work item has any linked work item at all.

Result:

```
true
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.comments.isEmpty}}
```

Test whether anybody commented yet.

Result:

```
false
```

Run on Jira Cloud on 29 Nov 2026.

```
This bug has {{issue.issuelinks.size}} related tickets
```

Build a sentence around a count. The number is 0 when there are no links.

Result:

```
This bug has 0 related tickets
```

Run on Jira Cloud on 29 Nov 2026.

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

Print the sentence only when links exist. With no links the whole block stays blank.

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- `{{else}}` is not an else branch. With a true condition both texts were printed one after the other, and with a false condition the else text was missing (checked on Jira Cloud, November 2026). Use two separate if blocks.
- size counts items, not characters. For the length of a text use `length()` on the text itself.

## Related

- [first, last, get(), getFromEnd()](https://goingstellar.ro/reference/smart-values/list-first-last-get/)
- [{{#list}}…{{/}} iteration](https://goingstellar.ro/reference/smart-values/list-iteration/)
- [{{#if}} … {{/}}](https://goingstellar.ro/reference/smart-values/if/)
- [and(), or(), not()](https://goingstellar.ro/reference/smart-values/and-or-not/)
- [length()](https://goingstellar.ro/reference/smart-values/length/)

## Sources

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

