Adding a custom field to email, but custom field is not appearing in the email

Deepak Bhatia September 18, 2011

Hi,

I am following the example of adding custom field to email as given in below link

https://developer.atlassian.com/display/JIRADEV/Adding+Custom+Fields+to+Email

The below is added to email/text/issuecreated.vm

#if ($issue.getCustomFieldValue("customfield_11193") != -1)
$stringUtils.leftPad($issue.getCustomField("customfield_11193").name, $padSize): $issue.getCustomFieldValue("customfield_11193")
#end

The below is added to the email/text/includes/issuesummary.vm

#if ($issue.getCustomFieldValue("customfield_11193") != -1)
>$stringUtils.leftPad($issue.getCustomField("customfield_11193").name, $padSize): $issue.getCustomFieldValue("customfield_11193")
#end

But the custom field is not appearing in the email.

Regards

Deepak Bhatia

4 answers

1 accepted

0 votes
Answer accepted
Jaan Raamets
Contributor
September 18, 2011

Try use

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

like in documentation, not

#if ($issue.getCustomFieldValue("customfield_11193") != -1) .

The first solution worked for me, your solution did not with JIRA 4.4 and issuecommented.vm.

Deepak Bhatia September 18, 2011

https://developer.atlassian.com/display/JIRADEV/Adding+Custom+Fields+to+Email

The example given in the above link is based for text based emails. But generally we use html based emails. Hence when I changed the HTML velocity templates, the above worked.

Yes you are right, #if ($issue.getCustomFieldValue("customfield_11193")) is working correctly. Rather the example given in the above is working correctly.

Thanks

Deepak Bhatia

0 votes
Wendy Hynes July 26, 2012

I have tried the above on jira4.1, unfortunately it doesn't work. I am basically trying to add a text custom field which should be straight forward. Please help

0 votes
Jo-Anne MacLeod
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.
September 18, 2011

did you remember to restart JIRA in order to have the changes take effect?

0 votes
Deepak Bhatia September 18, 2011

Yes, I have restarted the jira. Also I have made the

class.resource.loader.cache=false
velocimacro.library.autoreload=true

to make changes in the velocity modules dynamic.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events