Smart values for fields 1

When we created Automation for Jira, our primary goal was to create a simple, yet powerful app for Jira, that anyone could use. No API or scripting knowledge required.

We introduced smart values to solve this problem and add extra power to the rules. For the vast majority of your use cases, you can simply choose the smart values you need from our available values.

However, if you want to dig in and find the right value in your Jira instance, keep on reading.

Finding your smart value

The syntax follows the JSON representation of an issue in Jira, which can be accessed using Jira’s REST API. Firstly, to make your life much easier, you can download an extension to prettify your JSON. We use JSONView extension for Chrome, which helps you extract smart values from the REST API and makes looking at the fields and their values must easier.

Use the following URL to view the JSON representation of your issue:

https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names

Navigate to the field value you want to display in your rule and click on the field. Then copy the ‘dot notation’ in the footer:

In this example, the priority field is selected, which means the smart value is {{issue.fields.priority.name}} however, the fields section is not required so you could just use {{issue.priority.name}} or shorten it further to {{priority.name}}.

The trick with custom fields

Sometimes custom fields in Jira can be tricky. In the URL above notice the parameter ?expand=names? This provides the following handy guide at the start of the output:

You can see the field "Status AT&T" is a custom field and the name of the field isn't used:

From this, you can see that you can reference this field in a smart value using {{customfield_11200.value}} however, you can also substitute customfield_11200 for the field's actual name (which makes it easier to read too) {{Status AT&T.value}}.

If in doubt, try it out!

It is highly recommended to use the Log action to help you figure out and debug smart values, see debugging a rule. You can also surround smart values with the debug function to do the same thing. If you pair this action with a manual trigger then it makes it really easy to test. Go to the issue that has a value set for the field set and manually trigger the rule - you can then find the results immediately in the audit log.

Last modified on Jun 24, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.