Automation For Jira - How to mention the assignee of a Jira issue in a comment
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The purpose of this article is to describe how to write an automation rule that will add a comment to a Jira issue that is mentioning the assignee.
Environment
- Jira Server/Data Center on any version from 8.0.0
- Automation For Jira on any version from 7.4.0
Note about Jira user's key and username
The Jira Server/Data Center version 8.4.0 introduced a new way to store user's keys in the Jira Database, as per the section Generating user keys in the documentation GDPR changes in Jira.
Basically:
- the key any Jira user created after the upgrade to Jira 8.4.0 has the format "JIRAUSERXXXXX" (which does not match the user's username)
- the key of Jira user created before the upgrade is the same as the user's username
For this reason, using the smart value below to mention the issue assignee in a comment will not work for users created after Jira was upgraded to 8.4.0 or any higher version, since the key no longer matches the user's username:
[~{{issue.assignee.key}}]
Using such syntax will result in a comment added to a ticket as shown below, which will not be a clickable link, since JIRAUSERXXXX is not a username, but the user key:
[~JIRAUSERXXXXX]
Solution
To mention the assignee in a comment, you will need to use the syntax below instead:
[~{{issue.assignee.name}}]
The automation rule could look like the one illustrated in the screenshot below: