How to find the correct smart value for fields in Jira

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. Enter smart values to solve this problem - they allow access to pretty much any issue data in an automation rule. If you're not familiar with them, jump over here first before continuing this article.

The big question is, how do I know the correct value?

Finding your smart value

Finding the correct syntax is, thankfully, pretty straightforward as it 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, install the free JSONView extension for Chrome which will help you extract smart values from the REST API.

Then, 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: Clicking on a field to find its value

In this example we have selected the priority field which means our smart value is {{issue.fields.priority.name}} however the fields section is not required and we're discouraging its use so you could just use {{issue.priority.name}} or shorten it further to just {{priority.name}}.

The trick with custom fields

Sometimes custom fields in Jira can be tricky and there is no exception here. In the URL above you'll notice that we're providing the parameter ?expand=names. This provides the following handy guide at the start of the output: expanded names example

You can see the field "Status AT&T" is a custom field. When we go to find it, the name of the field isn't used: expanded name field example

From this we can see that we can reference this field in a smart value using {{customfield_11200.value}} however, even though it isn't mentioned here, we can 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!

We highly recommend that you use our ‘Log action’ to help you figure out and debug smart-values, see debugging a rule. You can also surround smart-values with our 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 represents the type you're working with and manually trigger the rule, you can then find the results immediately in the audit log.

If you find a field that should support smart-values, but doesn't yet, please let us know and we’ll add support for it!