Formatting smart values in Jira automation

Smart values allow you to access and manipulate issue data in Jira. If you want to customise smart values, you can choose to format them differently.

How do I use smart values?

You can use smart values to save time and effort, by instantly inserting data into your automation rules, such as names, timezones, and other information. For example:

  • The smart value {{now.plusDays(5)}} returns the current time and adds 5 days to it.

  • The smart value {{issue.summary}} returns the summary of the selected issue.

Let’s look at an example of how smart values can be used in the automation rule builder. Say you wanted to add a comment to an issue once it is transitioned to ‘In Progress’, and in this comment, you want to address the reporter and assignee of this issue by name. All you need to do is insert the right smart values in the appropriate places in your comment:

Smart values being used to build a rule in Jira automation.

Formatting smart values

Smart values use the Mustache library, preventing arbitrary code execution. To make a substitution, you need to wrap the value in double curly brackets. For example, {{examplevalue}}.

If you want to reference child elements, you’ll need to include a period in your value. For example, {{issue.key}}.

Accessing issue fields

To access issue fields, you can use the field's name: {{issue.My custom field name}}.

If the field is an object, reference the value within it. For example, if it is a user custom field, use: 

1 {{issue.My user field.displayName}}

Field names aren’t case sensitive and are translated using your rule actor's language setting. If you're trying to access custom fields with translated names in your smart values, then you need to use the language set for your rule actor user.

If there are multiple custom fields with the same name, or have the same name as a system field, you can also use the custom field ID. For example:

1 {{issue.customfield_10001}}

See Accessing issue fields for more detailed information.

Using # for sections and lists

When you want to iterate over a number of items, you can use #, as it will produce the same action for everything captured by the smart value. When you use #, you must always end with {{/}} to close it. In the example below, the action prints a list of comment authors:

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

To treat items as a number when using math functions, use {{#=}}. For example, to perform a simple calculation to add 100 to an "Invoice Amount" custom field on your issue, you can use:

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

Default values

If a field or value doesn't exist, it usually returns an empty value, such as {{invalid reference}}.

If you need to have a value, you can specify a default value. For example, when an "invalid reference" doesn't contain a value, you can print "Hello world" using {{invalid reference|Hello world}}.

View more available smart values

See a list of available smart values in Jira automation


Still need help?

The Atlassian Community is here for you.