Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »


JETI's Field Picker drop down allows you to select system or custom field and get the snippet of 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 for this is that when you develop a new template you may want to have your custom HTML structure and layout.

If you develop a template based on JETI's or Jira's default templates, you can use the below HTML markup to add your fields:

HTML markup to add fields to your email templates
#if($!jetiFieldRenderer.renderCustomField($issue, 'customfield_12345'))
<tr>
    <th>
        Name of the customfield_12345:
    </th>
    <td>
		$!jetiFieldRenderer.renderCustomField($issue, 'customfield_12345')
    </td>
</tr>
#end

Add Rich Text (jEditor rendered) Field

 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 this:

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

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


The complete body of the default mail template extended with a custom field should look as follows.

Default email template with a custom field
#disable_html_escaping()
<p>$!mailBody</p>
#defaultMailHeader("email.event.activity.created.issue", $issue.reporter)
#set ($issueTitleBody="#parse('templates/email/html/includes/patterns/issue-title.vm')")
#rowWrapperNormal($issueTitleBody)
#rowWrapperNormalBegin('' 'wrapper-special-margin')
<table class="keyvalue-table">
    #parse("templates/email/html/includes/fields/issuetype.vm")
    #parse("templates/email/html/includes/fields/affectsversions.vm")
    #parse("templates/email/html/includes/fields/assignee.vm")
    #parse("templates/email/html/includes/fields/attachments.vm")
    #parse("templates/email/html/includes/fields/components.vm")
    #parse("templates/email/html/includes/fields/createddate.vm")
    #parse("templates/email/html/includes/fields/duedate.vm")
    #parse("templates/email/html/includes/fields/environment.vm")
    #parse("templates/email/html/includes/fields/fixversions.vm")
    #parse("templates/email/html/includes/fields/labels.vm")
    #parse("templates/email/html/includes/fields/priority.vm")
    #parse("templates/email/html/includes/fields/reporter.vm")
    #parse("templates/email/html/includes/fields/securitylevel.vm")
    #parse("templates/email/html/includes/fields/timetracking.vm")
 
<tr>
    <th>
        Name of the customfield_12345:
    </th>
    <td>
		$!jetiFieldRenderer.renderCustomField($issue, 'customfield_12345')
    </td>
</tr>

    #if ($!emailDef.emailOptions.addComments)
    <tr>
        <th>#text("common.words.comments"):</th>
        <td>
            #foreach ($comment in $!publicComments)
            <p style="border-bottom: 1px solid #DDD;">
              <p style="font-weight: bold;"><a href="$!baseurl/secure/ViewProfile.jspa?name=$!{comment.author}"><b>$!{comment.authorFullName}</b></a> - <b>$!{dateformatter.format($comment.created)}</b></p>
            <p>$!{rendererManager.getRenderedContent($!commentRendererType, $!comment.body, $issue.issueRenderContext)}</p>
            </p>
            #end
        </td>
    </tr>
    #end
</table>
#rowWrapperNormalEnd()
#if ($issue.description)
#rowWrapperNormal("#parse('templates/emailissue/email/html/description.vm')", '', 'issue-description-container')
#end
#set ($commentActionBody="#parse('templates/email/html/includes/patterns/comment-action.vm')")
#rowWrapperNormal($commentActionBody)
#parse("templates/email/html/includes/footer.vm")
  • No labels