User mentions in form of Vlad can be added in Jira text fields like description, comments etc. A typical business requirement is to notify that user when he or she is mentioned. 

This page explains how to achieve that requirement.


Sending a notification when user was mentioned in issue description

1) Create a new notification type of "issue updated". Assign project(s), issue type(s), fields and JQL as needed.

2) In Email input field provide a template similar to below:

Email
#foreach ($issue in $issues)
  #set ($mentions = $jirassimo.collectMentions($issue.fields.description))
  #if ($mentions)
    #foreach ($m in $mentions)
      $m.emailAddress ,
    #end
  #end
#end


In line 2 we're making a call to custom function collectMentions which takes a Jira field as input and returns a collection of User objects representing users that were mentioned in that field. If it was not possible to get an email of some user then it be skipped and no error raised.

On line 3 we ensure that there's something in the collection and on line 4 iterate through each user and returning his email. Note the comma after $m - that separates several emails.


Sending a notification when user was mentioned in a comment

1) Create a new notification of type Jira Issue Event → issue commented

2) In Email input field provide a template similar to below:

Email
#foreach ($issue in $issues)
  #set ($mentions = $jirassimo.collectMentions($issue.lastcomment.plain_body))
  #if ($mentions)
    #foreach ($m in $mentions)
      $m.emailAddress ,
    #end
  #end
#end


This script will return a comma-separated list of emails of users that were mentioned in the last comment added to the issue