Add custom field to JIRA e-mails


I would like to add custom field to JIRA 5.1 html notifications e-mail. I found that I need to modify velocity templates , e.g. issuecreated.vm. In that file i found references to the include folder to specify which fields to include.

Could you please advise how to make .vm file for custom field to include it into issuecreated.vm?

Thank you in advance.

Regards, Georgiy

2 answers

1 accepted

2 votes
Answer accepted


lets assume your customfield has id 11800

in your your_new.vm file put this info:

#if ($issue.getCustomFieldValue("customfield_11800"))
<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("NAME OF YOUR FIELD"):</strong>
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">

then include it in issuecreated.vm like this:

#if ($issue.getCustomFieldValue("customfield_11800"))
$stringUtils.leftPad($issue.getCustomField("customfield_11800").name, $padSize): $issue.getCustomFieldValue("customfield_11800")

this will make your field appear in emails only if it has values...

I made new.vm file as you advised and then included it into issuecreated.vm file as


and it works as needed :)

Thank you very much!

glad i could help...

Shouldn't the closing</tr> tag be positioned before the #end

Cheers Christian

oh you're right. just for optical satisfaction...but it works like this (i took it from current working instance)

ok i just re-checked with an out-of-the-box file that came with jira..

cat atlassian-jira/WEB-INF/classes/templates/email/html/includes/fields/reporter.vm

&lt;tr valign="top"&gt;
    &lt;td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;"&gt;
        &lt;strong style="font-weight:normal;color:${textSubtleColour};"&gt;#text("issue.field.reporter"):&lt;/strong&gt;
    &lt;td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;"&gt;
        #if ($issue.reporterId)
            #authorlinkkey($issue.reporterId $linkstyle)

I am encountering a problem with including custom fields in e-mail templates. The template does not appear to evaluate the getCustomFieldValue it simply output the raw code, see below. The custom field has a value for the issue I am sending the e-mail from. Is there a setting or other action needed to get the custom fields to work or is my code wrong? Any advice is appreciated. I am running JIRA 6.3.15 Code in template file: #if ($issue.getCustomFieldValue("customfield_10011")) $stringUtils.leftPad($issue.getCustomFieldObjectByName("customfield_10011").name, $padSize): $issue.getCustomFieldValue("customfield_10011") #end Participant: $issue.getCustomFieldValue("customfield_10011") Result in e-mail: Participant: $issue.getCustomFieldValue("customfield_10011")

Hi Faysal,

     As you mentioned first, In which folder could i past that code can you clarify that i need priority_Hcp customfield is to add in email.


Thank you,


You can create your own vm or templates,you can refer custom fields as below.



Is the following syntax OK?



Basically what I'm asking is, can we use getCustomFieldObjectsByName() function?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 10 hours ago in United States

Atlassian acquires AgileCraft

         Good Day, Bad bad traffic, not sure why!!!! 1/2 hour commute took me 2 hours today 🤯 What helped me is that I kept browsing LinkedIn until...

38 views 3 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you