スマート バリューとは

Smart values are dynamic variables that can make your rule more flexible. They can add power and complexity to your automation rules.

スマート バリューをフォーマットする

Each smart value is constructed using a specific syntax called dot notation inside double mustache brackets. It's written as a hierarchy, starting with a top-level object and followed by properties of that object, {{object.property.subProperty}}. This practice of connecting properties, sub-properties, and functions into a single smart value is sometimes called “chaining”.

Notice that multiword properties use camelCase capitalization.

  • {{issue}} → top‑level object

  • {{issue.summary}} → property

  • {{issue.assignee.displayName}} → sub‑property

特定のスマート値が何をするのかを理解しようとする際は、英語として後ろから読むことで分かりやすくなります。次に例を示します。

{{page.title}} is "the title of the page" (that's relevant to your rule component).

{{page.parent.title}} は「(関連する) ページののタイトル」です。

Functions and methods

In addition to chaining sub-properties, smart values can be amended with functions. Functions are operations you’re asking the system to perform on that value. Functions are easy to identify because they are always followed by parentheses ( ). The parentheses may or may not be empty. For example:

{{now.plusDays(5)}} is “add 5 days to the current time”

{{issue.summary.toLowerCase()}} is “lower case the Summary of the work item (issue)”.

Other functions might include substring() or concat().

How to use smart values

When a field in a step supports smart values, it will have double mustache brackets next to it. You will only see values that are valid for the rule you’re editing, based on its trigger and steps.

To use smart values

  1. Select an action that requires you to input your own text, such as the Send customized email action.

  2. テキスト フィールドの {} ボタンを選択すると、互換性のあるスマート値リストが開きます。

  3. 目的のスマート値が見つかったら、コピー アイコンを選択してテキスト フィールド貼り付けます。

To see which functions you can use (like toLowerCase() or substring()), open the {} smart values panel in a flow, then look under Advanced formatting.

In Jira Automation, you can investigate the REST API to find available smart values for a work item. See how to find smart values for a Jira Cloud field.

スマート バリューをテストする

スマート バリューが何を返すかテストする方法:

  1. Open the automation rule builder.

  2. ルールのトリガーとして [Manual trigger from work item (作業項目の手動トリガー)] を選択します。

  3. ルールのアクションとしてログ アクションを選択します。

  4. 作業項目に移動して [ルールを実行] を選び、手動でルールをトリガーします。

  5. The result will be visible in the audit log.

スマート バリューの関数をチェーン化する

スマート関数を連結するだけで、1 つのステップで複数の変換を適用できます。

下の例では、スマート値 toLowerCasesubstringconcat を連鎖させて作業項目の要約を小文字に変更し、最初の 10 文字だけを残して、文末に !! を追加します。

{{issue.summary.toLowerCase().substring(0, 10).concat("!!")}}

セクションとリストでスマート値を使う

複数のアイテムがあるスマート値を操作する際は、# とスマート値を併用してルールをリストのすべてのアイテムに適用できます。

たとえば、スマート値 {{issue.comments}} を使用してアクセスし、作業項目のコメントを返します。ただし、作業項目にコメントが複数ある場合は、スマート値 {{#issue.comments}} によって各コメントで個別にルールが反復されます。# を使用する際は、式を {{/}} で閉じる必要があります。

たとえば、作業項目のコメント作成者の一覧を出力するには、以下を使用します。

{{#issue.comments}}Author: {{author.displayName}}{{/}}

To treat items as numbers, use {{#=}} when using a math function. For example, to add 100 to an Invoice amount custom field:

{{#=}}{{issue.Invoice Amount}} + 100{{/}}

デフォルト値

フィールドまたは値が存在しない場合は空の値 ({{invalid reference}}) を返します。これを避けるためにデフォルト値を指定できます。

たとえば、無効な参照に値が含まれていない場合、{{invalid reference|"Hello world"}} を使用して Hello world を表示できます。

Customizing your smart values

In Jira Automation, you can define your own custom smart values using the Create variable action.

You can also customize smart values, functions and methods in the smart values help panel. Under the Custom fields tab, you can find customized values that are specific to the spaces or scope your rule will be running in. You can also input your own data into the functions and methods under the Advanced formatting tab, which allows you to easily customize their output.

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。