It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Add custom field to JIRA e-mails

Georgiy Senenkov Dec 04, 2012


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
C. Faysal Dec 04, 2012


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")

C. Faysal Dec 04, 2012

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

Georgiy Senenkov Dec 04, 2012

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!

C. Faysal Dec 04, 2012

glad i could help...

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

Cheers Christian
C. Faysal May 28, 2013

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)

Will Nov 21, 2015

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")

pokalav May 11, 2017

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,


1 vote
sreenivasaraju P Dec 04, 2012

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

32 views 0 0
View post

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you