Jira Automation smart value
List iteration in Jira Automation: syntax and examples
A block that opens with a list name and closes with {{/}} repeats its content once per item. Inside the block you can read the item's own properties, print the item itself with a dot, and use first, last and index to control separators and prefixes.
Syntax
{{#list}}...{{/}}
{{#list}}{{.}}{{^last}}, {{/}}{{/}}
{{#list}}{{#first}}...{{/}}{{/}}
{{#list}}{{index}}{{/}}
Arguments
| Argument | What it is | Required |
|---|---|---|
first / last | Inside the loop, {{#first}} runs only for the first item and {{#last}} only for the last. {{^first}} and {{^last}} run for every other item. | no |
index | The position of the current item, counted from 0. | no |
. | The current item itself, used when the list holds plain values such as labels. | no |
Works on
- Fields: any list, such as issue.labels, issue.comments or the result of split().
- Returns: the text of the block, repeated once per item.
Examples
{{#issue.labels}}{{.}}, {{/}}Print every label. A separator written inside the block also lands after the last item.
Result:
checkout, demo, Run on Jira Cloud on .
{{#issue.labels}}{{.}}{{^last}}, {{/}}{{/}}Print the labels as a clean comma list by skipping the separator after the last item.
Result:
checkout, demoRun on Jira Cloud on .
{{#issue.labels}}option-{{.}}{{^last}},{{/}}{{/}}Turn labels into option values for a field or an outgoing request, with a prefix and no trailing comma.
Result:
option-checkout,option-demoRun on Jira Cloud on .
{{#issue.comments}}{{index}}. {{body}}{{^last}},{{/}}{{/}}Number the comments of a work item in one line. The first item has index 0.
Result:
0. First comment from QA,1. Second comment: fixed in build 42Run on Jira Cloud on .
{{#issue.labels}}{{#first}}primary: {{/}}{{.}}{{^last}}, {{/}}{{/}}Mark the first label as the primary one and still separate the rest with commas.
Result:
primary: checkout, demoRun on Jira Cloud on .
{{#issue.summary.split(" ")}}[{{.}}]{{/}}Chain a text function with a loop: wrap every word of the summary in brackets.
Result:
[Hello][World!]Run on Jira Cloud on .
Where the documentation differs
{{#issue.comments}}{{#last}}Last: {{/}}{{body}}{{/}}Run on Jira Cloud, : the documentation says
Places "Last:" in front of the first comment., the actual result isFirst comment from QALast: Second comment: fixed in build 42.
Pitfalls
- The Atlassian text says
{{#last}}Last: {{/}}goes in front of the first comment. The prefix lands in front of the last comment, which is what a block named last should do (checked on Jira Cloud, November 2026). - Labels are plain text values, so the loop needs
{{.}}.{{name}}inside a label loop renders an empty string. - A separator inside the loop appears after every item, the last one included. Put it in
{{^last}}...{{/}}, or use join() when you only need a separated list. - Nothing is added between items on its own: comment bodies printed in a loop run together unless the block ends with a space, a comma or a line break.
Questions and answers
Does the index start at 0 or at 1?
At 0. With two comments, {{#issue.comments}}{{index}}{{/}} prints 01.