Forums

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

Can I use automation to send an email to someone who is mentioned in the comments?

Rob Brooks July 11, 2024

When an issue is moved to a new column, say from Backlog to In Progress, I'd like to send an email out to all parties involved, including any names that are "@Name" in the comments. Is this possible? Right now I'm getting this message when I try it:

Jira Message.jpg

I'm totally new to using Jira automation, just discovered it this week, so any help would be very much appreciated!

3 answers

1 accepted

2 votes
Answer accepted
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.
July 11, 2024

Hi @Rob Brooks -- Welcome to the Atlassian Community!

What problem are you trying to solve by doing this notification on issue transition?  That is, "why do this?"  Knowing that may help the community to offer other suggestions.

Until we know that...

Although it is possible to scan all the comments to identify the mentioned users, and loop over them to send emails, that will be a very slow rule to process if you have several mentions.  And, it is limited to up to 100 mentions spanning all comments.

An alternative would be to automatically add the mentioned users in comments as watchers with an automation rule, allowing the built-in notifications to do the email work.  One advantage (or disadvantage, based on perspective) of this approach is it allows people to opt-out of the push notifications; sending the email directly will not allow this opting out, unless the person uses email rules in their email app to delete them.

 

Kind regards,
Bill

Rob Brooks July 11, 2024

Hi, Bill, thanks. The reason behind this is because our issues are created by a power automate workflow, so the Reporter for everything shows as the creator of the workflow. we want the originator of the item (the person who fills out the Microsoft form) to be able to get updates as the issue is assigned or gets moved to new columns. Our organization is no longer supporting the version of Jira we're on so they won't add any new custom fields to this version. The new version is more restricted by our org and they won't let us set the board up the way we need it. I thought that if I could @someone then maybe I could base rules off of that.

So as you can see this is all a workaround issue. I do like the idea of adding them to the watch list. My next step I was about to look into was the notifications. If I can figure out how to make a rule that automatically assign a mention to the watch list, then I'll try that out. 

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.
July 11, 2024

To add the watchers for the mentions, an example rule could be:

  • trigger: comment added
  • smart value condition:
    • first value: {{issue.comment.last.body.split(" ").match("\[~accountid:(.*)\]")}}
    • condition: does not equal
    • second value: leave this empty
  • action: add watchers, using this smart value expression
{{issue.comment.last.body.split(" ").match("\[~accountid:(.*)\]").distinct}}

That works by splitting apart the last comment, helping the match to look for any mentions with their account id values, and finally returning the unique / distinct ones to add as watchers.

1 vote
Nicolas Grossi
Banned
July 11, 2024
Rob Brooks July 11, 2024

Thanks, Nicolas. I did find this thread, but I'm definitely not competent enough yet to be able to do all that. 

Like Nicolas Grossi likes this
0 votes
ALAA EDDINE ROUCADI July 11, 2024

Hi @Rob Brooks ,

First of all, please consider the recommendations from @Bill Sheboy .

Regarding the error message you encountered, you can resolve it by:

  • Using an intermediary variable, let's say varEmailRecipient, to store the email recipient.
  • Validating the expression you are using by implementing a Log Action that displays the value of your variable.
  • Using the intermediary variable in the Send Email" action by placing the value {{varEmailRecipient}} in the To field.

Regards,

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events