Jira smart values - lists

Check out how we use smart values in our Jira automation template library.

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. This smart value can reference further methods and properties.

{{issue.fixVersions.name}}

list.average

Finds the average of all numbers in a list.

{{issue.subtasks.Story Points.average}}

list.distinct

Returns all items in a given list, without duplicate items.

Example

Let’s say you want to gather a list of issues, and print a list of parent issues but without duplicates. You could use the Lookup issues action to gather your list of issues, and then use {{lookupIssues.parent.distinct}} to print all unique issue summaries.

list.isEmpty

Returns true if a list is empty, and false if the list isn't. For example, can be used to see if an issue has any issue links.

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

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. This smart value 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.

{{lookupIssues.get(0).summary}}

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.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.size

The size of the list.

{{issue.comments.size}}

list.sum

Finds the sum of all values in a list.

{{issue.subtasks.Story Points.sum}}

Combined function 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.

{{#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}}{{/}}

 

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}},{{/}}{{/}}

 

 

 

Additional Help