robotsnoindex
robotsnoindex

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, while {{issue.summary}} will print off the summary of the issue.

Example

You can use smart values to add a comment to an issue on transition, addressing the name of the reporter and assignee of the issue.

Hi {{reporter.displayName}}

We're now looking into your issue {{issue.summary}}.

We'll get back to you soon with an update.

{{assignee.displayName}}

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, e.g. {{value}}.

Use a period to reference child elements, e.g. {{issue.key}}.

Finding a smart value

For the majority of cases, you can choose a smart value from the list of available functions.

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 access an issue field, use the field’s name: {{issue.My custom field name}}. Field names are case insensitive and are translated using your rule actor's language setting. Learn more about accessing issue fields.

To test what a smart value returns, use the Manual trigger with Log action. The result displays in the audit log, as shown below.


Chaining smart value functions

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.

{{issue.summary.toLowerCase().substring(0, 10).concat("!!")}}

Using smart values with sections and lists

When iterating over a number of items, use # to apply the smart value to all captured values. When using #, you’ll need to end with {{/}} to close it.

For example, to print a list of comment authors:

{{#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}}.