Adding fields to email templates

From the Field Picker dropdown default or custom fields can be chosen to get the snippet of the Velocity markup needed to extract the value of the field.

However, it does not render the complete HTML structure that you may need to keep the correct layout of the HTML content in your email body. The reason is that when developing a new template you might want to have your custom HTML structure and layout.

If you develop a template based on the custom Jira Email This Issue or the default templates of Jira, you can use the following HTML markup to add your fields:

Example HTML markup for adding fields to your email templates

#if($!issue.getCustomFieldValue('customfield_12345'))
<tr>
    <th>
        Name of the customfield_12345:
    </th>
    <td>
		#renderCustomField($issue, 'customfield_12345')
    </td>
</tr>
#end

Rich Text content in fields

JEditor allows you to enter Rich Text content in custom fields. In order to render Rich Text fields in email in Jira 6.x and later versions, you must add the following lines to your template:

#set ($fieldValueInHtml = $!jetiFieldRenderer.renderCustomField($issue, 'customfield_12345'))
$fieldValueInHtmle

Result: Using this technique the HTML content of the field value will not be escaped.

Last updated