Automation for Auto Assign and Mention in the Comments
Asked by Madison Brooks:

Hello!

I am trying to create an automation, I have had so much trouble with this task though.

++Want:++

when an incoming ticket is created that needs review - assign a person from a list AND mention them in the comments.

++What I have tried:++

Automation - When: Issue Created, If: Issue Matches JQL, Then: Assign the issue to, And: Comment, And: Send Email - Assignee

Issue -

##### [Send email](https://dvantage.atlassian.net/jira/software/c/projects/MDS/settings/automate#/rule/7031158/137169035) {#toc-hId--1645106276}

There is no value set for the field:  
assignee  
Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty.

SO then I made a second

automation - When: Issue assigned, If: Issue matches JQL, Then: Add Comment to Issue, And: Send email - Assignee

Issue -

only gets triggered when a user manually changes the Assignee.... not when the automation does it - which is what I was trying to solve for.  

<br />

With multiple attempts \& research, I am stuck on what I thought would be a simple problem.

Please help!


Answers:
author: Mark Segall
body: Hi [@Madison Brooks](/t5/user/viewprofilepage/user-id/4996405) and welcome to the community!

This is totally, possible, but I have to ask why there is a need to go through all three mechanisms of notification? Provided the notification scheme is set up for default behavior:

* Assigning the issue will send the assignee an email
* Commenting with an @mention will send an email
* Send Email function will obviously send an email

This means that every time the team member is assigned an issue they will get at least three emails (not counting any subscriptions they may have set up for themselves).

comments: author: Madison Brooks
body: THANK YOU!

The email was mostly just for testing why my comment was not working, my real goal is to have the user mentioned in a comment on the ticket so that they receive a jira notification (our team only works on @ mentions).

How can I get the assignee to not be null (as seen by my email error) so that I can use it to be mentioned in a comment on the ticket?


author: Madison Brooks
body: Nevermind,

I think found the answer to my question elsewhere.

I believe I needed the re-fetch issue data action? Then the assignee will be populated and I can use it to @ mention them in my comments.

![image (31).png](https://community.atlassian.com/t5/image/serverpage/image-id/208436i496B39D8778B1247/image-size/large?v=v2&px=999 "image (31).png")

Quick suggestion, next time could you please also provide the solution while also asking your question? Saying it "This is totally, possible, but" was not a useful solution to my issue.

If you have other solutions please share as I am excited to learn more about Jira!

Thanks!


author: Mark Segall
body: Sorry got called away after your response. I didn't have an exact solution on my first answer until I had additional context in your second and by the time I got back to this, you had found a solution on your own.

You are correct that this is a good scenario for the re-fetch action. If the rule sets the assignee then attempts to take action on that assignment, the rule may still be working under the initial fetch where the assignee was empty so the re-fetch helps recalibrate midstream.

I'm glad you were able to find a solution and hopefully you understand how our wires got crossed between comments... I don't typically "lecture and run" as a practice. ?


author: Ariela Orian
body: Hi  
I have an automation that is adding a comment with mention.

I'm using \[\~accountid:{{issue.assignee.accountId}}\]

for the mention,

But what I get in the comment is \[\~accountid:ariela\]

and no email is sent as a result of the mention....

Any idea what I'm doing wrong?  

The action on my automation is:  

![automation_comment.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/276617i6098765D72926F29/image-size/large?v=v2&px=999 "automation_comment.jpg")

and the resulting comment on the issue is:  
![issue_comment.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/276618i88168B457B2183EC/image-size/large?v=v2&px=999 "issue_comment.jpg")  

and no email is sent :(

Will appreciate any help ....

Thanks

Ariela


author: Ariela Orian
body: RESOLVED

This notation in the automation comment works -

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

It interprets to the user mention in the issue, and email is sent as expected

Thanks


author: Arif
body: it didn't work on me :(.

the comment result is like this :

**Hi \[\~:JIRAUSER17615\]**

even though I have followed the same notation:

**Hi \[\~:{{issue.assignee.accountId}}\]**

I am using Jira Data Center, is it the cause?


author: Arif
body: Update:

it's solved in JIRA DC by using this notation:

**Hi \[\~{{issue.assignee.name}}\]**


Tags: assign

email