Hey,
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:
https://confluence.atlassian.com/display/JIRA/Customising+Email+Content
https://developer.atlassian.com/display/JIRADEV/Adding%20Custom%20Fields%20to%20Email
https://answers.atlassian.com/questions/115392/jira-email-notification-subject-adjustments
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 10.250.205.193 /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(ASTReference.java:277)
Any ideas?
Hi,
Use as below
#set($cField=$customFieldManager.getCustomFieldObject("customfield_12562"))
$issue.getCustomFieldValue($cField)
I'll try it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have tried similar kind in the mail subject & it is working perfectly fine.
looks like there is some other problem in your case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the longValue() method:
#set($cFieldValue=$issue.getCustomFieldValue($cField).longValue().toString())
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.