Remove Internal comments from an Ad-Hoc Notification

Scenario

JEMH will not send internally comments to Non-Agent or Non-Collaborator recipients in a Jira Service Management (JSM) project. If an Internal Comment is added during a transition, such as when closing an issue, Customer Users will not receive a notification. A workaround to this issue is to use an Ad-Hoc notification

Ad-Hoc Notifications

Ad-Hoc notifications sent as part of JEMH Post Function are not inhibited by comment visibility. For more info see:

Because Ad-hoc Notifications are not inhibited customers who should not receive internal comments could be sent internal comments.

The Script

The following script can be used as part of a larger Ad-hoc notification to allow/remove comments.

Text

#if ($comment && !$jemhUtils.isPrivateJSDComment($comment.getAuthorApplicationUser(),$comment)) $!comment.getBody() #end

HTML

#if ($comment && !$jemhUtils.isPrivateJSDComment($comment.getAuthorApplicationUser(),$comment)) #parse('templates/email/html/includes/patterns/comment-top.vm') #end

 

Example in Use

Issue Resolved transition:

Used in place of an Issue Closed Notification, the following template will update Customers of an issue closed event without displaying an internal comment:

#disable_html_escaping() #set ($resolution = "<strong>$textutils.htmlEncode(${issue.getResolutionObject().getNameTranslation($i18n)}, false)</strong>") #defaultMailHeaderWithParam("email.event.activity.closed.issue", $changelogauthor, $resolution) #if ($comment && !$jemhUtils.isPrivateJSDComment($comment.getAuthorApplicationUser(),$comment)) #parse('templates/email/html/includes/patterns/comment-top.vm') #end #set ($issueTitleBody="#parse('templates/email/html/includes/patterns/issue-title.vm')") #rowWrapperNormal($issueTitleBody) #if ($changelog) #set ($changelogBody="#parse('templates/email/html/includes/fields/changelog.vm')") #rowWrapperNormal($changelogBody) #end #set ($commentActionBody="#parse('templates/email/html/includes/patterns/comment-action.vm')") #rowWrapperNormal($commentActionBody) #parse("templates/email/html/includes/footer.vm")

Issue Resolution

Resolution Notification