Add Custom Field Value to Email Template

Hello all, how could i put a custom field value to an existing email template ?

1 answer

I do not manage to integrate my field, you know how can it be done?

Yes, it's covered in the document I pointed to.

It is not very clear, I have to modify only issuecreated.vm in the folder " text " or in all the folders?

I'm not sure what is unclear in those docs.  You have to find every file that generates part of the body of an email where you want to include the field and add the required code for your field to it.

I'm afraid "it doesn't work" tells us nothing about what might have gone wrong.

I can nothing tell you except that what I have make by following the documentation does not show the deliberate custom field.

If you've followed the docs, then the field will be there in the email.  So, trace through what you are doing in full - which files, what type of email, was the field filled etc.  Try some basic debugging - try sticking plain text in the template - does that come out?

The id of my field is 10007 so i've add "

#if ($issue.getCustomFieldValue("customfield_10007"))

$stringUtils.leftPad($issue.getCustomField("customfield_10007").name, $padSize): $issue.getCustomFieldValue("customfield_10007")

#end " in /template/email/text/issuecreated.vm.

 

I've changed the values in velocity.properties to not have to restart JIRA.

Then when i create a new issue, there is no custom fields in the mail template..

Ok, that looks good. Some more debugging (apologies if some of these seem obvious, but if I don't ask the full set, we might miss something)

  • When you create the issue, do you fill in field 10007 with any data?
  • When you altered the properties file, did you restart JIRA?
  • I'm not 100% sure that the velocity caching applies to the mail templates, so you might want to restart anyway.
  • I assume you're getting the mail with no extra fields, but are you getting the right type?  Is your profile set to get plain text email?
  • What happens if you add plain text to the template?  Just above or below your #if #code #end block, could you add something obvious like "I need to know if this hack comes out" in just plain text, no punctuation or attempts at formatting.

 

Yes the field 10007 is filled with data.

Oh ok, i'll restart.

What do you mean by "get plain text email" ?

I restarted the instance, I added a sentence in the file but it does not display on the e-mail.

Your profile has a setting for getting emails in plain text or html.  Make sure yours is set to text

I received the mail with the sentence inside.

 

Ah, good, so you were editing the plain text templates, and receiving html emails?

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,006 views 5 18
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot