Automation basics
Understand the general concepts and best practices of automation in Atlassian Cloud products.
Smart values allow you to access and manipulate issue data within Jira. They can add significant power and complexity to your rules. For example:
the smart value {{now.plusDays(5)}} references the current time and adds 5 days to it
{{issue.summary}} prints the summary of the issue.
Smart values use the Mustache library, preventing arbitrary code execution. To make a substitution, you need to wrap the value in double curly brackets, e.g. {{value}}.
Use a period to reference child elements, e.g. {{issue.key}}.
For the majority of cases, you can choose a smart value from our reference documentation - learn more about Jira smart values.
If your instance is highly customized, you will need to investigate the REST API to find the right smart value. Learn more about finding the smart value for field.
To test what a smart value returns:
Navigate to an issue, and select Rule executions to manually trigger your rule.
The result displays in the audit log, as shown below.
You can apply multiple transformations in one step by chaining your smart functions.
You can change an issue’s summary to lowercase, only use the first 10 characters, and add !! to the end using the following example.
1
{{issue.summary.toLowerCase().substring(0, 10).concat("!!")}}
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 an issue's comment. However, if the issue 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:
1
{{#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:
1
{{#=}}{{issue.Invoice Amount}} + 100{{/}}
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"}}.
You can define your own custom smart values using the Create variable action.
Check out how we use smart values in our Jira automation template library.
Was this helpful?