スマート バリューとは
Smart values are dynamic placeholders that allow you to access and manipulate data within Atlassian Cloud. They can add power and complexity to your automation rules. The output returned by a smart value won’t be the same for every user; it changes based on the specific work item, page, or other context in which your automation rule is running.
For example, the smart value {{now.plusDays(5)}}
finds the current time and adds 5 days to it, and {{page.created}}
returns the date and time that a specific Confluence page was created.
スマート バリューをフォーマットする
Smart values use the Mustache library to maximise security and reliability. To create a smart value, you need to wrap text in double curly brackets, such as {{value}}
.
Use a period to reference child elements, such as {{comment.author}}
.
How can I find available smart values?
You can find a list of available smart values by accessing the smart values help panel in the rulebuilder:
Open an existing rule you want to add smart values to in the rulebuilder, or start creating a new rule.
Select an action that allows you to input your own text, such as the Send email action.
Select the
{}
button in the text field you want to add smart values to. This will open the help panel.You can now browse through a list of available smart values, and paste them into your text field.
A list of smart values that are available for use can also be found in our support documentation.
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.
スマート バリューをテストする
This feature is only available in Jira Automation.
スマート バリューが何を返すかテストする方法:
Open the automation rulebuilder.
Select Manual trigger as your rule’s trigger.
Select Log action as your rule’s action.
Manually trigger your rule by navigating to a work item, and selecting Rule executions.
The result will be visible in the audit log.
スマート バリューの関数をチェーン化する
You can apply multiple transformations in one step by simply chaining your smart functions.
In the example below, we’re chaining the toLowerCase
, substring
, and concat
smart values to change a work item’s summary to lowercase, keep only the first 10 characters, and add !! to the end.
{{issue.summary.toLowerCase().substring(0, 10).concat("!!")}}
セクションとリストでスマート値を使う
複数のアイテムがあるスマート値を操作する際は、# とスマート値を併用してルールをリストのすべてのアイテムに適用できます。
For example, the smart value {{issue.comments}}
is used to access and return a work item's comment. However, if the work item has multiple comments, the smart value {{#issue.comments}}
would make your rule iterate on each comment individually. When using #, you must close the expression with {{/}}.
For example, to print a list of comment authors on a work item:
{{#issue.comments}}Author: {{author.displayName}}{{/}}
アイテムを数値として扱うには、数学関数を使用する際に {{#=}}
を使用します。たとえば [Invoice amount] カスタム フィールドに 100 を追加するには、次のようにします。
{{#=}}{{issue.Invoice Amount}} + 100{{/}}
デフォルト値
フィールドまたは値が存在しない場合は空の値 ({{invalid reference}}
) を返します。これを避けるためにデフォルト値を指定できます。
たとえば、無効な参照に値が含まれていない場合、{{invalid reference|"Hello world"}}
を使用して Hello world を表示できます。
Customising your smart values
In Jira Automation, you can define your own custom smart values using the Create variable action.
You can also customise smart values, functions and methods in the smart values help panel. Under the Custom fields tab, you can find customised values that are specific to the projects 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 customise their output.
To see more about smart values, check out how we use them in our Jira automation template library.
この内容はお役に立ちましたか?