Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

Code Block
titleEmail
linenumberstrue
#foreach ($issue in $issues)
  #set ($mentions = $jirassimo.collectMentionsEmailscollectMentions($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 collectMentionEmails collectMentions which takes a Jira field as input and returns a collection of emails 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 returned. 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:

Code Block
titleEmail
linenumberstrue
#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