# List first, last, get() in Jira Automation: examples

URL: https://goingstellar.ro/reference/smart-values/list-first-last-get/

first and last return the ends of a list. get(index) counts from the start and getFromEnd(index) counts from the end, both starting at 0. Use them to read the latest comment, the first label or one word of a split text.

## Syntax

```
{{list.first}}
{{list.last}}
{{list.get(index)}}
{{list.getFromEnd(index)}}
```

## Arguments

- `index` (required: yes): The position of the item. For get() 0 is the first item, for getFromEnd() 0 is the last one.

## Works on

- Fields: any list, such as issue.comments, issue.labels or the result of split().
- Returns: one item, so you can read its properties with a dot.

## Examples

```
{{issue.comments.last.body}}
```

Quote the most recent comment in a notification.

Result:

```
Second comment: fixed in build 42
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.comments.first.body.left(5)}}
```

Chain a text function on the first comment to keep a short preview.

Result:

```
First
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.comments.get(1).body}}
```

Read the second comment by position. Counting starts at 0.

Result:

```
Second comment: fixed in build 42
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.comments.getFromEnd(1).body}}
```

Read the comment before the latest one.

Result:

```
First comment from QA
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.labels.first}}
```

Use the first label as the main category of the work item.

Result:

```
checkout
```

Run on Jira Cloud on 29 Nov 2026.

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

Take the last word of the summary after splitting it on spaces.

Result:

```
World!
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- An index past the end of the list renders an empty string: `{{issue.labels.get(5)}}` and `{{issue.labels.getFromEnd(5)}}` both come out blank (checked on Jira Cloud, November 2026). Check the size first when a blank would break the next step.
- A negative index is an error, not a way to count from the end. `{{issue.labels.get(-1)}}` fails with `Failed to get value for issue.labels.get(-1)`. Use getFromEnd(0) for the last item.
- A user property such as `issue.comments.last.author` renders the account id. Add `.displayName` when people will read the message.

## Related

- [{{#list}}…{{/}} iteration](https://goingstellar.ro/reference/smart-values/list-iteration/)
- [size and isEmpty on lists](https://goingstellar.ro/reference/smart-values/list-size-isempty/)
- [join()](https://goingstellar.ro/reference/smart-values/list-join/)
- [split()](https://goingstellar.ro/reference/smart-values/split/)
- [{{issue.comments}}](https://goingstellar.ro/reference/smart-values/issue-comments/)

## Sources

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

