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 Atlassian Cloud. 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 an issue
{{page.created}} prints the date and time that a Confluence page was created
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:
In Jira Cloud automation, you can also investigate the REST API to find all smart values for an issue. Learn more about finding the smart value for a Jira Cloud field.
This is only available in Jira Cloud automation.
To test what a smart value returns:
Create a rule with the following setup:
Trigger: Manual
Action: Log
Manually trigger your rule by navigating to an issue, and selecting Rule executions.
The result displays in the audit log.
You can apply multiple transformations in one step by chaining your smart functions.
In the example below, we’re chaining the toLowerCase, substring, and concat smart values to change an issue’s summary to lowercase, keep only the first 10 characters, and add !! to the end.
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 a Jira 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 on a Jira issue:
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"}}.
In Jira Cloud, 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?