Status | ||||
---|---|---|---|---|
|
In JEMHCloudJEMH Cloud, recipients can be added pragmatically using Velocity scripts. With this feature, JIRA users, JIRA groups and Email addresses can be dynamically added as recipients of Issues notificationsIssue, Ad Hoc notification or Post Function notifications.
...
The text area input supports Velocity scripts. Use Ctrl+Space in the editor to view the velocity's context ($recipientUtils's methodmethods, $context.issue, etc.).
Resolved recipients will be added as BCC in the notifications.
Info |
---|
JEMHCloud doesn't duplicate emails. if an email has been resolved by several configurations (static or script), the recipient will receive the notification only once. |
Conditional recipients in Ad-Hoc Notifications and Post Functions
Recipients scripts can be added to AdHoc and Post Function Notifications as TO, CC or BCC. Each script resolves the recipients for each type. E.g.: A recipient the CC script resolves, will receive the email as CC.
Velocity contexts and notification mechanisms are the same in all three features (Issue, AdHoc and Post Function notifications)
Examples
The following examples can be used in Issue, Adhoc and Post Function notification:
Code Block | ||
---|---|---|
| ||
##If issue priority is blocker and type is bug, notify JIRA user johnfixall #if ($context.issue.fields.priority.name.textValue() == "Blocker" && $context.issue.fields.issuetype.name.textValue() == "Bug") $recipientUtils.addUserRecipients("johnfixall") #end ##If issue is of project SD, notify email users devLead@mycompany.com and testLeader@mycompany.com #if ($context.issue.fields.project.key.textValue() == "SD") $recipientUtils.addEmailRecipients("devLeader@mycompany.com,testLeader@mycompany.com") #end ##If issue priority is Major, notify support level 3 group #if ($context.issue.fields.priority.name.textValue() == "Major") $recipientUtils.addGroupRecipients("support-level-three") #end ##If issue priority is MinMinor, notify support level 1 and level 2 groups #if ($context.issue.fields.priority.name.textValue() == "Minor") $recipientUtils.addGroupRecipients("support-level-one,support-level-two") #end ##If operation was made by CEO user or issue reporter's CEO user, notify management #if ($context.user.key.textValue() == "ceo" || $context.issue.fields.reporter.key.textValue() == "ceo" ) $recipientUtils.addGroupRecipients("management") #end |
Testing
Issue notifications can be tested by creating or updating Issues through JIRA user interface, JEMH Cloud's email processing or JEMH Cloud's test cases. These actions will generate issue events JEMH Cloud listens.
You can see these events and the processing outcome by going to JEMHC configuration -> Auditing -> Events.
After being processed, an event will have a report showing the recipients resolved, notifications sent and the problems or warnings found. Use these reports to validate the recipients the script has resolved.
An event can be re-processed by clicking the action Run so you can tweak the script and re-run events testing the script possibilities.
Warning |
---|
Re-running an event will resend the emails. To avoid spamming your users, use a test mail server like mailtrap or disable the mail server by going to Notifications -> Message Outbound. |