Email template not working

Jason Li Ting Chung
Contributor
February 8, 2021

Hi Community,

Find below a script on email template that is supposed to display the content of external comments in the email template.

Unfortunately, it is not working as expected while giving errors.

Is there something wrong with the script?

<%
def comments = com.atlassian.jira.component.ComponentAccessor.commentManager.getComments(issue)?.collect {
def isInternal = { com.atlassian.jira.issue.comments.Comment c ->
def commentProperty = com.atlassian.jira.bc.issue.comment.property.CommentPropertyService.getProperty(user, c.id, SD_PUBLIC_COMMENT).getEntityProperty().getOrNull()
if (commentProperty)

{ def props = groovy.json.JsonSlurper.parseText(commentProperty.getValue()) props['internal'].toBoolean() }

else

{ null }

}

if (isInternal(it) == false){ //If internal comment = false (it is external comment)
"External Comments >> ${it.body} <br>"
}else

{ //If it is internal comment "" }

}?.join("<br>")
%>

$comments

Thank you in advance for you support.

Best regards,
Jason Li

0 answers

Suggest an answer

Log in or Sign up to answer