Problem: Your users are adding comments which are limited by visibility to specific Project roles, like shown on example screenshot below:


How to configure a Raley Emails Notifications so, that it would only trigger when a comment is added by a user in project role Administrators ?


Solution: Create a Notification configuration like shown in the example below:


Say, that you want to notify issue reporter and issue watchers but only if they have specific role in this project. In our example, we'll use role Administrator.

So, instead of picking "Reporter" and "Issue watcher" from TO combobox, you'll add the following script in the free-form email section (just to the right from TO) like this:


restricted comment notification template
#if ($jirassimo.userHasRole("Administrators", "MFP", $!issue.fields.reporter.key))
  $!issue.fields.reporter.emailAddress ,
#end

#foreach ($watcher in $!issue.watches.watchers)
  #if ($jirassimo.userHasRole("Administrators", "MFP", $!watcher.key))
    $!watcher.emailAddress ,
  #end  
#end


On the first line we check if reporter has project permission Administrators in project MFP and on the 6-th line we check the same for every issue watcher. Please note, that you'll need to add commas after each emailAddress, as there could be several emails and they need to be separated by commas