Forums

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

How to get a custom field (number or date field) to display in the velocity template?

Kevin Ultsh June 7, 2019

Hello everyone and thank you in advance. I followed this article to add some custom fields to emails and it works with text fields but not with number/date fields. Has anyone got this to work? Thank you! See screenshots for what I see in the email.

CustomNumberFieldError.png

2 answers

0 votes
Kevin Ultsh June 10, 2019

.

0 votes
Tuncay Senturk
Community Champion
June 8, 2019

Hello Kevin,

Actually getting the value for number/date is same. Only different formatters can be used.

Are you sure that the issue has non empty Business Value custom field value. And is this Business Value field a standard Jira Number field?

Kevin Ultsh June 10, 2019

Yep, I can confirm the field is not empty and I've tried with both a standard date field and standard number field. It actually doesn't matter if the value is empty or not, I get the same result.

Tuncay Senturk
Community Champion
June 10, 2019

Ok followup question, what's @customfield? Did you define it before usage?

Any chance to share the entire vm file?

Kevin Ultsh June 10, 2019

Here is the vm file for the custom field. I get the custom field ID from the DB and reference it in the vm file. (customfield_13811)

#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_13811"))
#if($issue.getCustomFieldValue($customfield))
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
$issue.getCustomFieldValue($customfield)
</td>
</tr>
#end

Tuncay Senturk
Community Champion
June 10, 2019

Sorry, I could not find anything wrong with your code. It is as it is supposed to be.

Suggest an answer

Log in or Sign up to answer