What are smart values?
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.
Formatting smart values
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.
Testing a smart value
This feature is only available in Jira Automation.
To test what a smart value returns:
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.
Chaining smart value functions
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("!!")}}
Using smart values with sections and lists
When working with smart values that have multiple items, you can use # with the smart value to apply your rule to every item in the list.
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}}{{/}}
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{{/}}
Default values
If a field or value doesn't exist, it will return an empty value: {{invalid reference}}
. You can specify a default value to prevent this.
For example, when invalid reference doesn't contain a value, you can print Hello world using {{invalid reference|"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.
Was this helpful?