Jira smart values - lists

The following smart values are available to access and format the value of items in a list when setting up a rule.

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}},{{/}}{{/}}
Last modified on Apr 7, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.