Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automated rule to access to the last comment with tagged user

Giada Ermacora March 14, 2022

Hi guys, I'm trying to set an Automation rule in order to send an email to userB when userA has been tagged on the last comment (I need to be sure to check ONLY the last comment and not all the comments).

 

I've tried to use smart value {{issue.comment.last.body}} in order to access to the last comment text and try to match it with "test@gmail.com" or "[~test@gmail.com]" but none of these are working.

 

If I try to use JQL condition like:  comment ~ "test@gmail.com" it works, but it validates ALL the comments and so this doesn't resolved my needs as I only need to perform some actions when a specific user is tagged on the LAST comment added.

 

Could you please help? thanks in advance!

2 answers

1 accepted

0 votes
Answer accepted
Mark Segall
Community Champion
March 14, 2022

Hi @Giada Ermacora and welcome to the community!

What if you try this for your JQL condition?

{{issue.comment.last.body}} ~ "test@gmail.com"
Giada Ermacora March 14, 2022

@Mark Segall unfortunately not, it throws an error as the comparison seems to be from text to text instead from field content to text, see my attachment. I’ve already tried to change @ with the suggested escape but nothing...I guess the JQL is wrong in this wayE9797A66-CE4F-4581-84A9-2BB576B7B33C.jpeg

Mark Segall
Community Champion
March 14, 2022

Instead of JQL, try an advanced compare condition.  If the advanced condition matches, then you send the email.

Giada Ermacora March 14, 2022

It works! Thanks @Mark Segall 

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 15, 2022

Hi @Giada Ermacora 

If you are trying to find Jira mentions in the comments, rather than just an email address, please note that mentions appear in comment body as:

[~accountid:the_users_id_value] Here is a mention!

Please consider searching for that expression in those cases using match() rather than a JQL search/comparison.

Kind regards,
Bill

Giada Ermacora March 16, 2022

Hi @Bill Sheboy thanks for the heads up, I'm not able to find the user ID on Jira Server unfortunately, if I try to inspect the users, on the URL I can only see this:  "jira/secure/ViewProfile.jspa?name=name@test.com" without any user ID (I know on the Cloud is visible directly on the URL instead), is there any other way to discover it? thanks

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2022

First thing: if your rule works with Jira Server with the email address for the mentions, keep using that.  If not...

Perhaps try this JQL in advanced search to see if the user's name will lookup and replace with the account ID, as it does with Jira Cloud:

assignee = "enter the user name here"

You may then use that account ID value in the rule.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events