/* * All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner * license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed * or amended and must be included in any circumstances where the code snippet is shared by You or a third party." */importcom.adaptavist.hapi.jira.mail.Mailimportcom.adaptavist.hapi.jira.users.Usersdefissue=event.issuedeflatestComment=issue.comments.last().bodyif(latestComment.contains('~')){defusernames=latestComment.split(' ').collect{if(it.contains('[')&&it.contains(']')&&it.contains('~')){it.replace('[','').replace(']','').replace('~','').trim().replace(',','').trim()}}-[null]defdisplayNames=usernames.collect{filtered->Users.getByName(filtered).displayName}defemails=usernames.collect{filtered->Users.getByName(filtered).emailAddress}defbody=""" Hi ${displayNames.join(',')}, Reporter ${issue.reporter} has mentioned you on this issue ${issue.summary}, ${issue.key} for further assistance. Please find the below comment: ${latestComment} """Mail.send{setFrom('mail@mailbox.com')setSubject('Auto Notification')setTo(emails.join(','))setBody(body.toString())setHtml()}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.