Custom field in E-mail subject


I've been looking around but I can't get waht I want. I want a custom field (number field) shown in my email subject.

According to those posts:

I have edited the issuecreated.vm in the subject folder. That's what I have:

($issue.key) $issue.getCustomFieldValue("customfield_12562") $issue.summary

Watching the mail queue it seems like it should be working (cf is shown) but the logs show me the following error:

2013-05-14 12:57:07,764 http-8090-6 WARN CzaiaC 777x546x1 zs956v /secure/admin/MailQueueAdmin!default.jspa [velocity] org.apache.velocity.runtime.exception.ReferenceException: reference : template = getEncodedBodyFromContent [line 1,column 14] : $issue.getCustomFieldValue("customfield_12562") is not a valid reference.
	at org.apache.velocity.runtime.parser.node.ASTReference.render(

Any ideas?

1 answer

1 accepted

1 vote
Accepted answer


Use as below



Strange... The subject seems to be correct if you look at the mail queue but as soon as the mail gets sent, the subject is empty (apart from the configured prefix)

Are you still having the issues, even after using the above code.

Also in the error list which you have shared it states that $issue.getCustomFieldValue("customfield_12562") is not a valid reference.

Because issue.getCustomFieldValue(X), will take customfield & since you were not passing the Customfield you were getting error.

Also please check if the value returned is not null before using it in summary

Yes, the value is not null and I don't get an error in the logs now. The subject of the mail is just empty now...

Do I have to edit any other fields than issuecreated.vm in the subject folder?


I have tried similar kind in the mail subject & it is working perfectly fine.

looks like there is some other problem in your case.

I'm getting closer now:-) My next problem is, that my custom field is a number field (57670.0) but representing not a real number, more like a request number. Do you have any ideas how to get rid of the decimals to show only 57670?

You can use string split function, convert value to string (i.e .toString()) and then split it based on "." and then use the result accordingly

I used the longValue() method:


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

905 views 3 9
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