Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Jira

Articles

SHARE

Get Smart about your Jira Automation Smart Values

Rachel Wright

May 30, 2023

5

min read

In my last post, we talked about strategies for using automation rules in Jira Cloud. Now that you know how to build, test, and maintain rules, let’s improve their capabilities with smart values!

Smart values are a low-tech way to access and manipulate issue data. And don’t worry - no programming experience is required. Smart values are simply placeholders for variable information that changes. As an example, let’s say you need to notify many users that they’ve won a contest. Instead of manually sending multiple individual emails, you can send one message and use variables to insert specific information for each winner.

In the example, the highlighted areas are variables.

You can use this same concept in Jira for comments, notifications, issue creation and more. Jira stores a ton of data, so it’s great to be able to use that info in a dynamic way. Not using smart values in automation rules is like using Jira without JQL!

Experience the Ease & Confidence of NetSuite Customizations with Salto

Automate the way you migrate Jira configurations from sandbox to production

Push changes from sandbox to production

Start free 30-day trial ≥

Push changes from sandbox to production

Start free 30-day trial ≥

STAY UP TO DATE

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Structure and Syntax

Before I share some of my favorite examples, here’s a brief explanation of the structure of smart value variables.

  • Enclose smart values in double curly brackets so Jira distinguishes them from other content. For example: {{smart-value-goes-here}}

  • Smart values can access information in individual Jira issues, projects, fields, and more. To access this information specify its location and properties. For example, use {{issue.description}} to access the description of an issue in an automation rule. To access the issue’s assignee, use {{issue.assignee}}.

  • Smart values can be combined, formatted, and altered in many ways.

If Jira had sent the email message above, the syntax would look something like:

To: {{reporter.emailAddress}}
Subject: Congratulations {{reporter.displayName}} - you've won!

Congratulations {{reporter.displayName}}!
You’ve won a {{issue.Prize}} and it will be delivered on {{now.plusDays(14).shortDate}}.

We’re sending your prize to the following address you provided:

{{reporter.displayName}}
{{issue.Address}}
{{issue.City}}, {{issue.State}} {{issue.Zip}} 

Please let us know if you have any problems receiving your prize. Thanks for participating in our contest!

Sincerely,
The Ridiculous Example Company

The example accesses Jira’s standard issue reporter field and custom fields called prize, address, city, state, and zip. Additionally, I used {{now.plusDays(14).shortDate}} to calculate today’s date, add 14 days to it, and format the result for the delivery date.

Easy right? Well, easier than delivering a pony to an apartment at least!

Favorite Snippets

Now that we’ve covered the basic syntax, here are my favorite smart values and example ways to use them.

Tip: Copy the example syntax to create your own smart value library! I store my frequently used values and functions in a disabled automation rule so they are easy to cut and paste.

Access Commonly Used Information

  • Issue creation date: {{issue.created}}
  • Issue summary (“title”):{{issue.summary}}
  • Issue description: {{issue.description}}
  • Issue status: {{issue.status}}
  • Issue URL: {{issue.URL}} OR
  • For Jira: https://your-site.atlassian.net/browse/{{issue.key}}
  • For JSM: https://your-site.atlassian.net/servicedesk/
    customer/portal/4/{{issue.key}}
  • Assignee first and last name: {{issue.assignee.displayName}}
  • Assignee user ID: {{issue.assignee.name}}
  • Mention a user: [~accountId:157A98%3Ae5b8cc8b-4450-4c41-bk3b-ad5933507069]
  • Issue creator: {{creator.displayName}}
  • Issue reporter: {{issue.reporter.displayName}}
  • Issue watchers: {{issue.watchers}}
  • Issue links: {{issue.issuelinks}}
  • Latest issue comment: {{issue.comments.last.body}}
  • Issue attachment list: {{issue.attachment}}
  • Issue version name: {{version.name}}
  • Project key: {{project.key}}
  • Project lead first and last name: {{issue.project.lead.displayName}}
  • Project lead email address: {{issue.project.lead.emailAddress}}
  • Project lead ID: {{issue.project.lead.name}}
  • Smart values in JQL: "Epic Link" IN ({{issue.key}}) OR "parentEpic" IN ({{issue.key}})

Calculations

  • 30 days from now: {{now.plusDays(30)}}
  • Issue creation date plus 3 business days: {{issue.created.plusBusinessDays(3)}}
  • Next Monday’s date: {{now.withNextDayOfWeek("MON")}}
  • Next Monday’s date plus 7 days: {{now.withNextDayOfWeek("MON").plusDays(7).jqlDate}}
  • Convert time zone: {{now.convertToTimeZone("America/Los_Angeles").shortTime}}
  • Calculate percent complete: {{#=}}{{issue.timeSpent.divide(3600)}}-{{issue.original estimate.divide(3600)}}{{/}}
  • Add two custom number fields: {{#=}}({{issue.Dev Estimate}} + {{issue.QA Estimate}})*60{{/}}
  • Calculate sub-task story points: {{issue.subtasks.Story Points.sum}}
  • Calculate custom number field and hard coded value: {{#=}}{{issue.Cost}} * 0.6{{/}}

Format Results

  • Issue creation date plus 3 business days formatted as MM/dd/yyyy: {{issue.created.plusBusinessDays(3).format("MM/dd/yyyy")}}
  • Issue update date and timestamp: {{issue.updated.longDateTime}}

Favorite Examples

Here are some real-world examples of smart values in automation rules.


Link Related Issues

When a comment is added that contains an issue key, automatically link that issue to the other issue. 

Use the “Advanced compare condition” and the following:

  • First field: {{comment.body}}
  • Condition: contains regular expression
  • Regular expression: [A-Z]+-\d+

Use the “Link issues” action and the following:

  • Link type: relates to
  • Smart value: {{comment.body.match("([A-Z]+-\d+)")}}


Notify Requestor (JSM Customer) via Comment

Regularly check for unverified Jira Service Management requests, mark them resolved, and leave a comment for the requestor.

Use the “Comment on issue” action and the following:

  • Comment:
    Hi {{reporter.displayName}},
    We haven't heard back from you in a while, so we've closed this support request for now. If you still need assistance, please let us know by adding a comment to the request.

Detect New Comments and Attachments

Use the “Comment on issue” action and the following:

  • Comment:
    New comment added by: {{comment.author.displayName}}

    Attachments in {{Issue.key}}:

    {{#Issue.attachment}}
    * {{filename}} - Added {{created.mediumDateTime}} by {{author.displayName}}

{{/}}

Send Notification to Watchers

Use the “Send email” action and the following:

  • To: {{issue.watchers.emailAddress}}

Send Notification to Email Addresses in a Custom Field

Use the “Send email” action and the following:

  • To: {{issue.customField_11273}}

If / Then Statements

  • Check for a value in a custom field:
    {{#if(exists(issue.customField_10040))}}

Total cost: {{issue.customField_10040}}

{{/}}

Get List of Watchers

  • Current watchers:
    {{#issue.watchers}} 

* {{displayName}}

{{/}}

STAY UP TO DATE

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Push changes from sandbox to production

Start free 30-day trial ≥

Push changes from sandbox to production

Start free 30-day trial ≥

Activities to Try

Now it’s your turn! Start with a simple automation rule and smart value and expand its capabilities from there.

Ideas

  • Try out some of the examples above in your test environment
  • Create a custom “issue created” email to send to specific users
  • Send a custom notification to your team’s chat room before an SLA breach

Tip: Use my manual trigger and log action strategies to test variables and verify results are as expected.

Resources

WRITTEN BY OUR EXPERT

Rachel Wright

Atlassian Consultant

Rachel Wright started using Jira and Confluence in 2011, became an administrator in 2013, and was certified in 2016. Rachel also uses Atlassian tools in her personal life for accomplishing goals and tracking tasks. Her first book, the “Jira Strategy Admin Workbook“, was written in Confluence and progress was tracked in Jira!

Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Jira

Jira

SHARE

Get Smart about your Jira Automation Smart Values

Rachel Wright

May 30, 2023

5

min read

In my last post, we talked about strategies for using automation rules in Jira Cloud. Now that you know how to build, test, and maintain rules, let’s improve their capabilities with smart values!

Smart values are a low-tech way to access and manipulate issue data. And don’t worry - no programming experience is required. Smart values are simply placeholders for variable information that changes. As an example, let’s say you need to notify many users that they’ve won a contest. Instead of manually sending multiple individual emails, you can send one message and use variables to insert specific information for each winner.

In the example, the highlighted areas are variables.

You can use this same concept in Jira for comments, notifications, issue creation and more. Jira stores a ton of data, so it’s great to be able to use that info in a dynamic way. Not using smart values in automation rules is like using Jira without JQL!

What if Zendesk was 4x less work?

Request a Demo Get started with Salto

Structure and Syntax

Before I share some of my favorite examples, here’s a brief explanation of the structure of smart value variables.

  • Enclose smart values in double curly brackets so Jira distinguishes them from other content. For example: {{smart-value-goes-here}}

  • Smart values can access information in individual Jira issues, projects, fields, and more. To access this information specify its location and properties. For example, use {{issue.description}} to access the description of an issue in an automation rule. To access the issue’s assignee, use {{issue.assignee}}.

  • Smart values can be combined, formatted, and altered in many ways.

If Jira had sent the email message above, the syntax would look something like:

To: {{reporter.emailAddress}}
Subject: Congratulations {{reporter.displayName}} - you've won!

Congratulations {{reporter.displayName}}!
You’ve won a {{issue.Prize}} and it will be delivered on {{now.plusDays(14).shortDate}}.

We’re sending your prize to the following address you provided:

{{reporter.displayName}}
{{issue.Address}}
{{issue.City}}, {{issue.State}} {{issue.Zip}} 

Please let us know if you have any problems receiving your prize. Thanks for participating in our contest!

Sincerely,
The Ridiculous Example Company

The example accesses Jira’s standard issue reporter field and custom fields called prize, address, city, state, and zip. Additionally, I used {{now.plusDays(14).shortDate}} to calculate today’s date, add 14 days to it, and format the result for the delivery date.

Easy right? Well, easier than delivering a pony to an apartment at least!

Favorite Snippets

Now that we’ve covered the basic syntax, here are my favorite smart values and example ways to use them.

Tip: Copy the example syntax to create your own smart value library! I store my frequently used values and functions in a disabled automation rule so they are easy to cut and paste.

Access Commonly Used Information

  • Issue creation date: {{issue.created}}
  • Issue summary (“title”):{{issue.summary}}
  • Issue description: {{issue.description}}
  • Issue status: {{issue.status}}
  • Issue URL: {{issue.URL}} OR
  • For Jira: https://your-site.atlassian.net/browse/{{issue.key}}
  • For JSM: https://your-site.atlassian.net/servicedesk/
    customer/portal/4/{{issue.key}}
  • Assignee first and last name: {{issue.assignee.displayName}}
  • Assignee user ID: {{issue.assignee.name}}
  • Mention a user: [~accountId:157A98%3Ae5b8cc8b-4450-4c41-bk3b-ad5933507069]
  • Issue creator: {{creator.displayName}}
  • Issue reporter: {{issue.reporter.displayName}}
  • Issue watchers: {{issue.watchers}}
  • Issue links: {{issue.issuelinks}}
  • Latest issue comment: {{issue.comments.last.body}}
  • Issue attachment list: {{issue.attachment}}
  • Issue version name: {{version.name}}
  • Project key: {{project.key}}
  • Project lead first and last name: {{issue.project.lead.displayName}}
  • Project lead email address: {{issue.project.lead.emailAddress}}
  • Project lead ID: {{issue.project.lead.name}}
  • Smart values in JQL: "Epic Link" IN ({{issue.key}}) OR "parentEpic" IN ({{issue.key}})

Calculations

  • 30 days from now: {{now.plusDays(30)}}
  • Issue creation date plus 3 business days: {{issue.created.plusBusinessDays(3)}}
  • Next Monday’s date: {{now.withNextDayOfWeek("MON")}}
  • Next Monday’s date plus 7 days: {{now.withNextDayOfWeek("MON").plusDays(7).jqlDate}}
  • Convert time zone: {{now.convertToTimeZone("America/Los_Angeles").shortTime}}
  • Calculate percent complete: {{#=}}{{issue.timeSpent.divide(3600)}}-{{issue.original estimate.divide(3600)}}{{/}}
  • Add two custom number fields: {{#=}}({{issue.Dev Estimate}} + {{issue.QA Estimate}})*60{{/}}
  • Calculate sub-task story points: {{issue.subtasks.Story Points.sum}}
  • Calculate custom number field and hard coded value: {{#=}}{{issue.Cost}} * 0.6{{/}}

Format Results

  • Issue creation date plus 3 business days formatted as MM/dd/yyyy: {{issue.created.plusBusinessDays(3).format("MM/dd/yyyy")}}
  • Issue update date and timestamp: {{issue.updated.longDateTime}}

Favorite Examples

Here are some real-world examples of smart values in automation rules.


Link Related Issues

When a comment is added that contains an issue key, automatically link that issue to the other issue. 

Use the “Advanced compare condition” and the following:

  • First field: {{comment.body}}
  • Condition: contains regular expression
  • Regular expression: [A-Z]+-\d+

Use the “Link issues” action and the following:

  • Link type: relates to
  • Smart value: {{comment.body.match("([A-Z]+-\d+)")}}


Notify Requestor (JSM Customer) via Comment

Regularly check for unverified Jira Service Management requests, mark them resolved, and leave a comment for the requestor.

Use the “Comment on issue” action and the following:

  • Comment:
    Hi {{reporter.displayName}},
    We haven't heard back from you in a while, so we've closed this support request for now. If you still need assistance, please let us know by adding a comment to the request.

Detect New Comments and Attachments

Use the “Comment on issue” action and the following:

  • Comment:
    New comment added by: {{comment.author.displayName}}

    Attachments in {{Issue.key}}:

    {{#Issue.attachment}}
    * {{filename}} - Added {{created.mediumDateTime}} by {{author.displayName}}

{{/}}

Send Notification to Watchers

Use the “Send email” action and the following:

  • To: {{issue.watchers.emailAddress}}

Send Notification to Email Addresses in a Custom Field

Use the “Send email” action and the following:

  • To: {{issue.customField_11273}}

If / Then Statements

  • Check for a value in a custom field:
    {{#if(exists(issue.customField_10040))}}

Total cost: {{issue.customField_10040}}

{{/}}

Get List of Watchers

  • Current watchers:
    {{#issue.watchers}} 

* {{displayName}}

{{/}}

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Activities to Try

Now it’s your turn! Start with a simple automation rule and smart value and expand its capabilities from there.

Ideas

  • Try out some of the examples above in your test environment
  • Create a custom “issue created” email to send to specific users
  • Send a custom notification to your team’s chat room before an SLA breach

Tip: Use my manual trigger and log action strategies to test variables and verify results are as expected.

Resources

WRITTEN BY OUR EXPERT

Rachel Wright

Atlassian Consultant

Rachel Wright started using Jira and Confluence in 2011, became an administrator in 2013, and was certified in 2016. Rachel also uses Atlassian tools in her personal life for accomplishing goals and tracking tasks. Her first book, the “Jira Strategy Admin Workbook“, was written in Confluence and progress was tracked in Jira!