Jira smart values - lists
Some fields contain more than one option, such as checkboxes, labels, multi-selects, and multi-user pickers. You can use smart values to access these fields using several convenient methods we've added for working with lists.
On this page:
Let's explore a few use cases. Suppose you have a multi-checkbox field called 'Sydney Attractions' with three options:
- Harbour Bridge
- Opera House
- Bondi Beach
There are several ways to render this list of values:
List type | Smart value example | Output |
---|---|---|
Comma-separated list | {{issue.Sydney Attractions.value}} | Harbour Bridge, Opera House, Bondi Beach |
Dash-separated list | {{#issue.Sydney attractions}} {{value}}{{^last}}- {{/}}{{/}} | Harbour Bridge - Opera House - Bondi Beach |
Space-separated list | {{#issue.Sydney attractions}}{{value}} {{/}} | Harbour Bridge Opera House Bondi Beach |
Using join method | {{issue.Sydney attractions.value.join(" ")}} | Harbour Bridge Opera House Bondi Beach |
These types of fields use .value
to access the human-readable label. You can also access .id
. Applicable fields include:
- Select lists
- Multi-select lists
- Cascading select lists
- Radio buttons
- Multi-checkboxes
- Multi-user pickers
Multi-user pickers function similarly to other multi-fields, but you have full access to all of the user's attributes, such as .displayName
. For example, if you have an "Aussie actors" multi-user picker with:
- Hugh Jackman
- Nicole Kidman
- Eric Bana
You can use these smart values to access this picker:
Action | Smart value example | Output |
---|---|---|
Display names | {{issue.Aussie actors.displayName}} | Hugh Jackman, Nicole Kidman, Eric Bana |
Display names with email addresses | {{#issue.Aussie actors}}{{displayName}} ({{emailAddress}}) {{/}} | Hugh Jackman (hugh@wolf.com) Nicole Kidman (kid@nicole.com) Eric Bana (wog@aussie.com) |
Lists smart values
The following smart values are available to access and format the value of items in a list when setting up a rule:
- list
- list.join(separator)
- list.get(index)
- list.getFromEnd(index)
- list.first
- list.last
- list.size
- list.average
- list.max
- list.min
- list.sum
list
Iterates over a list and prints it. You can also reference further methods and properties.
{{issue.fixVersions.name}}
list.join(separator)
Iterates over a list and prints out items separated by the given characters. The smart value below prints the names of fix versions and join them together with " - "
{{issue.fixVersions.name.join(" - ")}}
Iterates over a list and prints it. You can also reference multiple further methods and properties.
{{#issue.fixVersions}}{{name}} {{releaseDate}}, {{/}}
Iterates over a list of labels and prints it (.
is a short hand to refer to the current item being iterated).
{{#issue.labels}}{{.}}, {{/}}
list.get(index)
The element at the specified index, where 0 denotes the first element in the array
{{issue.comments.get(1).body}}
list.getFromEnd(index)
The element at the specified index from the end, where 0 denotes the last element in the array
{{issue.comments.getFromEnd(1).body}}
list.first
The first item in a list. The example below is for the body of the first comment.
{{issue.comments.first.body}}
list.last
The last element of a list
{{issue.comments.last.author}}
list.size
The size of the list
list.average
Finds the average of all numbers in a list.
{{issue.subtasks.Story Points.average}}
list.max
Finds the highest number in a list, or finds the latest date in a list.
{{issue.subtasks.Due date.max}}
list.min
Finds the small number in a list, or finds the earliest date in a list.
{{issue.fixVersions.releaseDate.min}}
list.sum
Finds the sum of all values in a list.
{{issue.subtasks.Story Points.sum}}
Examples
Iterates over the list and only enters the "first" block on the first element. Can also use _first if the element has a method or property called first
{{issue.comments.size}} {{#list}}{{#first}}..{{/}}{{/}}
Prints all comment bodies and places "First:" in front of the first comment
{{#issue.comments}}{{#first}}First:{{author.key}}{{/}}{{body}}{{/}}
Iterates over the list and only enters the "last" block on the last element. Can also use _last if the element has a method or property called last.
{{#list}}{{#last}}..{{/}}{{/}}
Prints all comment bodies and places "Last:" in front of the first comment
{{#issue.comments}}{{#last}}Last: {{/}}{{body}}{{/}}
Iterates over the list and enters the "first" block on every element except the first element. Can also use _first if the element has a method or property called first.
{{#list}}{{^first}}..{{/}}{{/}}
Prints all comment bodies and places "Not First:" in front of all comments except the first
{{#issue.comments}}{{^first}}Not First:{{author.key}}{{/}}{{body}}{{/}}
Iterates over the list and enters the "last" block on every element except the last element. Can also use _last if the element has a method or property called last.
{{#list}}{{^last}}..{{/}}{{/}}
Prints all comment bodies and places a comma after each except the last comment
{{#issue.comments}}{{body}}{{^last}},{{/}}{{/}}
Prints the index of the current item. Can also use _index if the element has a method or property called index.
{{#list}}{{index}}{{/}}
The same as above but prints the index of the comment in front
{{#issue.comments}}{{index}}. {{body}}{{^last}},{{/}}{{/}}
Prints all labels each with a prefix of 'option-', and places a comma after each except the last label
{{#issue.labels}}option-{{.}}{{^last}},{{/}}{{/}}