Customized JIRA email templates not usable after upgrade from 5.2.4 to 6.1.6

Todor Kostadinov January 21, 2014

Hi all,

I'm using test enviroment to upgrade out JIRA from 5.2.4 to 6.1.6.

One of the issues I'm facing is that customized email templates are not working anymore after upgrade. Where can I find updated version of the guide for customizing JIRA email content?

Or if anyone can point me to the right template to use for custom fields?

Here is the example file address.vm:

#disable_html_escaping()
#if ($issue.getCustomFieldValue("customfield_10803"))
<tr valign="top">
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:${textSubtleColour};">#text("Address"):</strong>
    </td>
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
        $issue.getCustomFieldValue("customfield_10803")
    </td>
#end
</tr>

And my issuecreated.vm, where I parsed custom tempaltes:

#disable_html_escaping()
#parse("templates/email/html/includes/emailconstants.vm")
#parse("templates/email/html/includes/header.vm")
<tr valign="top">
    <td id="email-banner" style="padding:32px 32px 0 32px;">
        
        #if ($issue.reporterUser)
            #set ($reporter = "#authorlink2($issue.reporterUser.name $linkstyle)")
        #else
            #set ($reporter = "#text('common.concepts.no.reporter')")
        #end

        #set ($issueType = $issue.getIssueTypeObject())

        #set ($issueLink = "#renderIcon(${issueType.iconUrlHtml} ${issueType.getNameTranslation($i18n)}) <a style='color:${textLinkColour};text-decoration:none;' href='${baseurl}/browse/${issue.getKey()}'>$issue.getKey()</a>")

        #emailbanner($issue.reporterUser "email.event.activity.created" $reporter $issueLink "")
    </td>
</tr>
<tr valign="top">
    <td id="email-fields" style="padding:0 32px 32px 32px;">
        <table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
            <tr valign="top">
                <td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        #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/requester.vm")
						#parse("templates/email/html/includes/fields/city.vm")
						#parse("templates/email/html/includes/fields/address.vm")
						#parse("templates/email/html/includes/fields/phone.vm")
						#parse("templates/email/html/includes/fields/mobile.vm")
                        #parse("templates/email/html/includes/fields/description.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/project.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")
                    </table>
                </td>
            </tr>
        </table>
    </td>
</tr>
#parse("templates/email/html/includes/footer.vm")

4 answers

1 accepted

0 votes
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2014

I think, you should take a look at the differences between your templates and the ones provided with the system. There were some changes in the user handling from 5.x to 6.x, maybe there is a problem. E.g the line "#if ($issue.reporterUser)" is now "#if ($issue.reporterId)".

On the page https://developer.atlassian.com/display/JIRADEV/Development+Resourcesyou find pages to information for developers about the changes made to the system.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2014

A best practice for me for release changes is to implement the changes made into the templates provided with the software and not use the old templates.

Honeywell JIRA Admin June 6, 2014

how to change the color of hyperlinks in email templates.We had dark blue color in 6.0.8 and now in 6.2.5 it is sky blue color,how can I change it?

maciejopala June 9, 2014

There's BotoCssInliner, which job is to take rules from templates/email/css/*.css (however, it has hardcoded list of allowed files) and inject them into emails as inline styles. I believe it should be enough to change the line number 146 in templates/email/css/all-clients.css, which currently looks like this: a { color: #3b73af; text-decoration: none; }.

0 votes
maciejopala January 22, 2014

Hi,

additional information about changes made in email templates in JIRA 6.1 can be found at https://developer.atlassian.com/display/JIRADEV/JIRA+email+template+changes. This containts a few examples how particular templates changed, along with further tips how to use new templates and macros. Hope this helps.

Cheers,

Maciej

0 votes
Todor Kostadinov January 21, 2014

Well, I didn't try to use the all old templates, I just used the ones created by me.

And ofcourse I reproduced the changes from old main templates ( e.g. issuecreated.vm ) in the templates in new version.

But the last time I had a starting point from documentation about inserting custom fields in JIRA emails. Rigth now I'm not sure if this documentation is up to date with the version 6.1.6.

0 votes
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 21, 2014

Hi Todor,

I've encountered the same problem and I simply recreated the changes I did in the old templates into the new templates. It's actually quiet straigthforward. Especially if you use the information provided by Henning.

Best regards,

Peter

Suggest an answer

Log in or Sign up to answer