Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Why won't this custom field show up in our emails?

Paul Stahlke
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.
March 13, 2012

Hi, I am trying to get a custom field to appear in our plain text emails. The field properly appears in the email for the Create issue action which I know uses:
\atlassian-jira\WEB-INF\classes\templates\email\text\issuecreated.vm

However, for emails for other events, such as Comments or Resolved, the custom field doesn't appear, and I know it has a value in the issue. I know the template used in this case is:
\atlassian-jira\WEB-INF\classes\templates\email\text\includes\issuesummary.vm

And this is my code added:
#if ($issue.getCustomFieldValue("customfield_10661"))
>$stringUtils.leftPad($issue.getCustomField("customfield_10661").name, $padSize): $issue.getCustomFieldValue("customfield_10661")
#end

Why doesn't the custom field get displayed here?

4 answers

1 accepted

0 votes
Answer accepted
Paul Stahlke
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.
March 13, 2012

My bad. The problem was that I was putting the custom field within the attachments section's if/then logic. Thought I was outside of it, but I missed seeing that straggling #end statement!

#if ($attachments && $attachments.size() >0)
>$stringUtils.leftPad($i18n.getText("template.attachments"), $padSize): #foreach ($attachment in $attachments)$attachment.getFilename()#if ($velocityCount != $attachments.size()), #end#end

>
#end

0 votes
Paul Stahlke
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.
March 13, 2012

Thanks Sean. That makes sense. Although when I add the same bit of code right near the top of issuesummary.vm (just before #if ($issue.securityLevel)), then the field displays. It doesn't like it near the bottom, after the attachments section. I don't understand what would make the difference?

0 votes
Sean Curtis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2012

I'd have to check but I'm pretty sure fields only display on emails when they've been changed. If you edit an issue and change fields A, B and D you shouldn't see any mention of field C in the resulting email.

I'll take a look and see if there's a nice way to always show the value of a specific custom field on an email.

0 votes
Sean Curtis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2012

I'd have to check but I'm pretty sure fields only display on emails when they've been changed. If you edit an issue and change fields A, B and D you shouldn't see any mention of field C in the resulting email.

I'll take a look and see if there's a nice way to always show the value of a specific custom field on an email.

Suggest an answer

Log in or Sign up to answer