スマート バリュー - リスト
Check out how we use smart values in our Jira automation template library.
以下のスマート バリューを利用して、ルール設定時にリストの項目値にアクセスし、フォーマットできます。
list
Iterates over a list and prints it. This smart value can reference further methods and properties.
list.average
一覧のすべての数の平均を求めます。
{{issue.subtasks.Story Points.average}}
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.
{{#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.
{{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
リストの最初の項目です。以下の例は最初のコメントの本文です。
{{issue.comments.first.body}}
list.last
The last element of a list.
{{issue.comments.last.author}}
list.max
一覧の最も大きな数または最新の日付を検索します。
{{issue.subtasks.Due date.max
}}
list.min
一覧の最も小さな数、または一番早い日付を検索します。
{{issue.fixVersions.releaseDate.min
}}
list.size
The size of the list.
{{issue.comments.size}}
list.sum
一覧のすべての値の合計を求めます。
{{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}},{{/}}{{/}}