Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation: How to @mention user in Add Comment action?

wa1_kh00
Contributor
January 17, 2019

Hi!

I'm currently using the cloud version of Jira Service Desk and was trying to set up an automation rule for when status changed (this is the trigger). When a request is transitioned to a specific status (e.g., Awaiting Implementation), I want to Add Comment and @mention specific users so they're aware that this request is ready for them. However, it keeps telling me no users found.

I've already made sure that the rule's running user has the Browse users and groups permission. The interesting thing is that @mention works in the Alert User action (this could be a solution, but it's not ideal because I can't customize the alert message).

Does anyone know if I'm doing something wrong or didn't set something correctly? Or is this a known issue with Add Comment? If so, what's the workaround, besides getting a plugin (it just seems silly to me that I have to purchase a plugin to perform such basic/native functionality)?

14 answers

1 accepted

9 votes
Answer accepted
Christos Zachos
Contributor
May 24, 2019

Hello,

 

Just an accidental find while messing around that actually works. 

 

Step 1: Find the internal username

Go to any workflow and edit it. Go to create transition and add a Post Function.

At the Post Function page, pick Update Issue Field.

Choose Issue Field Assignee and pick the third option (start typing...)

Start typing the desired user. Find him/her and click.

What is written in the field after the click is some kind of internal username.

If there is an easier way to find out this username, please, let me know.

 

Step 2: Add the internal username to the comment exactly as [~internal-username]

 

Step 3: Click preview...

Christopher Gronde
Contributor
March 12, 2020

I would like to say that as of Jira 8.5.3. This no longer appears to work.  It used to work but we just got alerted that the users being tagged are no longer receiving emails from our postfuntion doing this

Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2020
Jon Davenport
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 14, 2021

The best way I have found is to go to a user's profile page, get their ID, and reference them in the action like this:

[~accountid:ACCOUNT-ID-HERE] do a thing
Like # people like this
Antonio Rodriguez
Contributor
April 13, 2023
[~accountid:ACCOUNT-ID-HERE] do a thing

works as of April 2023. Thanks Jon

Like # people like this
Zdeněk November 5, 2024
[~accountid:ACCOUNT-ID-HERE] do a thing

Still works, thank you very much! 

Like Steffen Opel _Utoolity_ likes this
Abdullah Said
Contributor
December 3, 2024

no such thing as username in jira, perhaps full name or email?

18 votes
Michael Buechele
Contributor
March 13, 2020

This works for me:

[~accountid:{{comment.author.accountId}}]
Maksim Chernyavskiy April 10, 2020

Thanks! It definitely works!

Jessica Golden
Contributor
May 6, 2020

This did not work for me - it simply resolves to "User" or "Former User" depending on the browser - I cannot get this to work correctly. I'm trying to @ a watcher or another user, but nothing works. Not even the assignee.

Like # people like this
Abir Stolov May 12, 2020

Me too, it links to UNKOWN_USER

Christine Rove Miranda
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2020

me too.. links to UNKNOWN_USER

Aaron Meeuwsen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2020

Be sure that you are asking the smart value for the correct context. In my case I needed the issue assignee for the card and not the comment author. Below are a few examples:

[~accountid:{{comment.author.accountId}}]
[~accountid:{{issue.assignee.accountId}}] 
[~accountid:{{issue.reporter.accountId}}] 

If you are wanting to use a static @ for a user that is not within context of the issue/comment you can do so by looking and passing their user hash. To do this simply click on the name of the user in any issue or comment to go to their profile.

You will see a url similar to: https://company.jira.com/people/687614:8ffcb0ed-ddbd-4688-8635-c76146f483. Given this link example your @ would look like:

[~accountId:687614:8ffcb0ed-ddbd-4688-8635-c76146f483]

Like # people like this
Joshua Kochelek
Contributor
January 29, 2021

Thank you SO MUCH @Aaron Meeuwsen ! 300px-Buddy_christ.jpg

Like # people like this
Hassina Uwamahoro
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 27, 2021

Many thanks Aaron.

However I have two rules and are triggering at the same time on the same ticket, yet they have different conditions.

Tobias Wieschnowsky
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 16, 2022

I don't think the .accountId is necessary. In my tests, both tag users successfully:

[~accountid:{{reporter.accountId}}]
[~accountid:{{assignee}}]

Before finding this thread I was trying just @{{assignee}} which ended up looking like @60dd74cbad9bba006a9c1a8b in the comment (which after checking is the account ID.

Like # people like this
17 votes
RECARO
Contributor
February 20, 2023

Hello everybody,

in case anyone is wondering and stuck the same as i was. The solution for JIRA SERVER which works for  Jira Project automation is using this:

E.g.

[~{{reporter.name}}]

[~{{assignee.name}}]

 

Clickable link to user profile/mention is placed in the comment :)

LC May 10, 2023

God bless you, your children and your children's children.

Ievgenii Vasiuk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2023

Thank you! That's it - worked for Jira Datacenter

Patrizia Heinzl
Contributor
July 10, 2023

Omg, thank you! Was going crazy since the other solution did not work!

Michelle Gronwold
Contributor
January 4, 2024

Perfect! This worked for me, whereas [~accountid:{{reporter.accountId}}] did not!!

Like Steffen Opel _Utoolity_ likes this
filzah.aziz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2024

Wow! Thanks! This works for me too!

Rinaldi James Michael
Contributor
November 18, 2024

Thank you so much :) !
The other solutions didn't work for Jira Data Center.

7 votes
Aaron Meeuwsen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2020

Be sure that you are asking the smart value for the correct context. In my case I needed the issue assignee for the card and not the comment author. Below are a few examples:

[~accountid:{{comment.author.accountId}}]
[~accountid:{{issue.assignee.accountId}}] 
[~accountid:{{issue.reporter.accountId}}] 

If you are wanting to use a static @ for a user that is not within context of the issue/comment you can do so by looking and passing their user hash. To do this simply click on the name of the user in any issue or comment to go to their profile.

You will see a url similar to: https://company.jira.com/people/687614:8ffcb0ed-ddbd-4688-8635-c76146f483. Given this link example your @ would look like:

[~accountId:687614:8ffcb0ed-ddbd-4688-8635-c76146f483]

Muly Gottlieb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2021

This- 

[~accountid:{{issue.reporter.accountId}}] 

Was exactly what I needed, thanks! 

Like João Paiva likes this
Johnny Hermann
Contributor
October 20, 2021

This markdown format with hardcoded numerical account ID ([~accountId:687614...]) also appears to work in replies to Jira notification emails.

The reply body becomes a Comment on the Jira issue, and the markdown account ID is correctly rendered as an @ mention (as though you had commented on the issue directly).  The @ mention will notify the user as expected (per their notification settings).

João Paiva
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 6, 2022

This- 

[~accountid:{{issue.reporter.accountId}}] 

Was exactly what I needed too!

3 votes
BurakK March 17, 2023

I'm using Jira Cloud and I would be able to tag creator and reporter with these two: 

[~accountid:{{issue.reporter.accountId}}] ->  Works for tagging Reporter

[~accountid:{{issue.creator.accountId}}] ->  Works for tagging Creator

2 votes
Malka
Contributor
May 14, 2020

@[~accountid:{{worklog.updateAuthor.accountID}}] is how I solved it for Cloud when trying to mention the last person to log time on an issue.

2 votes
Olivia Morris
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 24, 2019

@Christos Zachos Thanks for your comment, I have just tested this and your suggestion works!

When setting up the automated comment, I just needed to add [~olivia.morris] in the comment section. (the @ mention function doesn't work, it "can't find the user")

This means I can now skim through email notifications and see the update on them, without needing to click into every ticket to see why I have been notified. 

 

1. EDITING THE AUTOMATED COMMENT

Screenshot 2019-05-24 at 11.52.32 am.png

2. PREVIEWING THE AUTOMATED TICKET

Jira automated comment mentioning user solution 1.png

3. AUTOMATED EMAIL NOTIFICATION, WITH COMMENT (EXAMPLE)

Jira automated comment mentioning user solution 2.png

 

Thanks!

1 vote
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2019

@wa1_kh00, to be clear are you saying the users you are trying to mention are either agents for the project or they are say Jira SW licensed users that are in a group that has Browse and Add Comments permission? Assuming this is the case then they should show when you click Comment and @mention them. I would ask one of the users to verify that they can view and comment on an issue.

wa1_kh00
Contributor
January 17, 2019

@Jack Brickey In this case, they're agents (they're also Jira SW licensed users as well).

Well, if I were to manually comment on a request, I can @mention them. But not so in automation rules, specifically the Add Comment action.

Like Mark Hostetler likes this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2019

ah, my bad. was not thinking about automation. I have never attempted that but expect it is not possible. maybe others have different thoughts here.

wa1_kh00
Contributor
January 17, 2019

No worries! It's helpful to cross-check.

It would suck if it's not possible...love to hear what others have to say.

0 votes
Brian Boyle November 28, 2023

[~accountid:{{issue.assignee.accountId}}]

Abdullah Said
Contributor
December 3, 2024

what if neither assignee or reporter that we want to mention?

0 votes
Nova Squad
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2021

For Jira DC you can static comment/tag a user in the comments with [~username]

*replacing username with their Jira username

0 votes
Deleted user February 18, 2021

Hello , you just need this logic in the comment, you need to call the email of the user.

(For DATACENTER)

[~{{user.emailAddress}}]

If you want to mention for instance automatically the reporter:
[~{{reporter.emailAddress}}]

Or the assignee maybe:
[~{{assignee.emailAddress}}]

And so on....

0 votes
Nick Burgess October 23, 2020

For Jira Software Cloud, I tried this- [{{ currentUser | userInfo("displayName") }}|~accountid:{{ currentUser._accountId }}] 

This allowed me to successfully run a post function that mentions the current user of the issue.

Abdullah Said
Contributor
December 3, 2024

where do you get account id?

0 votes
Tasneem Abdelhamid April 15, 2020

i 've tried this , but no works,  still the field by default assigned to  

autoassign.jpg

Malka
Contributor
May 20, 2020

@Tasneem Abdelhamid Are you trying to update the field assigned or mention them? Your screen shot is assigning a field, but this question is addressing users for messaging within text fields.

0 votes
Olivia Morris
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 15, 2019

Screenshot 2019-05-15 at 3.08.38 pm.pngI also experience the exact same thing! 

 

I want to be able to post an internal comment, @'ing myself, when certain triggers occur, so that I get an email saying "@olivia, the SLA is about to breach" etc however i can't seem to be able to @ mention myself in the automated comment function. 

 

You can "alert" a user, but that just sends me an email saying "This ticket requires your attention", with no context to why. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events