Add custom field "Epic Link" on Jira notification emails

tifonas-katrina April 2, 2018

I need to add to the email notifications the "Epic Link" custom field.

I have used the below code:

#if ($issue.getCustomFieldObjectByName("customfield_10920"))
$stringUtils.leftPad($i18n.getCustomFieldObjectByName("customfield_10920").name, $padSize): $issue.getCustomFieldValue("customfield_10920")
#end

under WEB-INF/classes/templates/email/text and changed the velocity.properties, so as to avoid a restart.

 

Finally, I ended up with no email received.

Any ideas, how to add a custom field?

1 answer

1 accepted

0 votes
Answer accepted
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

Aikaterini,

 

After quite a bit of tinkering I was able to get the Epic Link field to render in a notification email.

 

I had to first create a new template for the custom field at <jira_install>/atlassian-jira/WEB-INF/classes/templates/email/html/includes/fields/epic.vm

#disable_html_escaping()
<tr>
<th>$stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize):</th>
<td>$issue.getCustomFieldValue("customfield_10000")</a></td>
</tr>

 

Since I was testing the template behavior when an issue was created I added the #parse line to the keyvalue-table found in <jira_install>/atlassian-jira/WEB-INF/classes/templates/email/html/issuecreated.vm

 <table class="keyvalue-table">
...
...
#parse("templates/email/html/includes/fields/epic.vm")
</table>

Once I did this the Epic Link field and value were rendered in the notification email when a new issue was created. Hope that helps! 

Suggest an answer

Log in or Sign up to answer