自動化スマート値 - リスト
Jira Automation テンプレート ライブラリでスマート バリューを使用する方法をご確認ください。
以下のスマート バリューを利用して、ルール設定時にリストの項目値にアクセスし、フォーマットできます。
list
リストを順に処理して、表示します。このスマート バリューは他のメソッドやプロパティを参照可能です。
{{issue.fixVersions.name}}
list.average
一覧のすべての数の平均を求めます。
{{issue.subtasks.Story Points.average}}
list.distinct
指定したリスト内のすべての項目を返します。重複する項目は含みません。
例
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
一覧が空白の場合は true を、空白ではない場合は false を返します。たとえば、課題に課題リンクがあるかどうかを確認するために使用できます。
{{#if(not(issue.issuelinks.isEmpty))}}
This bug has {{issue.issuelinks.size}} related tickets
{{/}}
list.join(separator)
リストを順に処理して、所定の文字で区切られた項目を出力表示します。以下のスマート バリューは修正バージョンの名前を表示し、" - " で名前を結合します。
{{issue.fixVersions.name.join(" - ")}}
リストを順に処理して、表示します。このスマート バリューは複数の他のメソッドやプロパティを参照します。
{{#issue.fixVersions}}{{name}} {{releaseDate}}, {{/}}
ラベルのリストを順に処理してそれを表示します (. は反復対象の現在の項目を参照するためのショートカットです)。
{{#issue.labels}}{{.}}, {{/}}
list.get(index)
指定したインデックスにある要素。0 は配列の最初の要素を指します。
{{lookupIssues.get(0).summary}}
list.getFromEnd(index)
末尾から指定したインデックスにある要素。0 は配列の最後の要素を指します。
{{issue.comments.getFromEnd(1).body}}
list.first
リストの最初の項目です。以下の例は最初のコメントの本文です。
{{issue.comments.first.body}}
list.last
リストの最後の要素。
{{issue.comments.last.author}}
list.max
一覧の最も大きな数または最新の日付を検索します。
{{issue.subtasks.Due date.max
}}
list.min
一覧の最も小さな数、または一番早い日付を検索します。
{{issue.fixVersions.releaseDate.min
}}
list.size
リストのサイズ。
{{issue.comments.size}}
list.sum
一覧のすべての値の合計を求めます。
{{issue.subtasks.Story Points.sum}}
関数を組み合わせて使う例
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}}..{{/}}{{/}}
コメント本文全体を表示し、最後のコメントの前に "Last:" を配置します。
{{#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}}..{{/}}{{/}}
コメント本文全体を表示し、最後のコメントを除く他の各コメントの後にカンマを配置します。
{{#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}}{{/}}
上記と同様ですが、前のコメントのインデックスを表示します。
{{#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}},{{/}}{{/}}
この内容はお役に立ちましたか?