Adding issue comments to emails
Last updated
Last updated
The default email template of Jira Email This Issue is prepared to render comments into the email body when the Add comments to outgoing emails option is enabled. However, if you develop your own custom email template not based on the default template, you'll have to add velocity template code to render the comments.
In order to add issue comments to the outgoing emails, two requirements must be met:
The option "Add comments to outgoing emails" has to be enabled in the corresponding component:
Email button (under OUTGOING EMAILS --> Manual Email Defaults --> Comments settings. Read more here.)
Bulk Email (under SETTINGS --> General Configuration --> Comments settings. Read more here.)
Post Function (under Issues --> WORKFLOWS --> Workflows. Read more here.)
Event Notification (under OUTGOING EMAILS --> Notifications --> Email settings. Read more here.)
A template fragment has to be added to your email template that will render the comments.
The template fragments are different for HTML and TEXT emails. You can use the Field Picker dropdown and select Comment.
The new email template themes make it possible to render comments in emails easily in various ways.
Comment rendering macro | Description | Order |
---|---|---|
| Renders all comments of the issue which are not restricted to groups or roles nor are internal comments in Service Management. | Ascending |
| Renders all comments of the issue which are not restricted to groups or roles. | Descending |
| Same as # | Ascending |
| Renders Service Management internal comments of the issue | Ascending |
| Renders all comments of the issue. Comments may be internal or public, restricted or visible to all. | Ascending |
| Renders the last comment entered in the issue |
|
| Renders the comment entered during the operation |
|
| Alias of |
|
| Generic, multi-purpose comment rendering macro. SINCE 8.0.3 Parameters:
|
|
It is possible to fully control how the comments are rendered in the email. The following codeblock example renders comments in HTML:
It is possible to fully control how the comments are rendered in the email. The following codeblock example renders comments in Text:
Normally comments are rendered by date ascending. To render them the latest on top, you must reverse the list:
In operations when the users enter a comment (like issue update, or workflow transitions), the comment they enter can be referred to as $!comment
or $!htmlComment
depending on the content type of the template.
In other cases, after reversing the comment list, you can access the last one easily:
Without reversing the list first, access the last comment as:
To access all comments of an issue, use the $commentManager
object.