Hi,
I have the following case:
I have configured 6 custom issue types custom issue field. Custom field "System" is present in 3 issue types. This custom issue field I need to add in email html notification.
It's ok when issue screen has this custom field, its added correctly in email.
But in case if custom field is not on screens of issue type, I got this line in email:
System: $issue.getCustomFieldValue("customfield_10204")
I have used: Adding custom fields to email instruction with little changes.
https://developer.atlassian.com/server/jira/platform/adding-custom-fields-to-email/
Bellow here system.vm field description.
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_10204"))
#if($issue.getCustomFieldValue($customfield))
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
<th>$stringUtils.leftPad($issue.getCustomField("customfield_10204").name, $padSize):</th>
<td>$issue.getCustomFieldValue("customfield_10204")</a></td>
</td>
</tr>
#end
As I understood condition line #if($issue.getCustomFieldValue($customfield)) is incorrect ore doesn't work.
What is the better way to fix it?
Hello @ypertsov
Please see this link
You have to use "set" to set the custom field value and then later you can refer to it.
#set ($cf = $customFieldManager.getCustomFieldObject('customfield_10301')) #set ($cfValue = $cf.getValue($issue)) cost center: $cfValue
Hello @Tarun Sapra
It was not full answer, but big help.
Finally I made it this way:
#disable_html_escaping()
#set ($cf = $customFieldManager.getCustomFieldObject("customfield_10204"))
#set ($customfieldvalue = $cf.getValue($issue))
#if($customfieldvalue)
<tr>
<th>#text($cf.name):</th>
<th>$customfield</th>
</tr>
#end
After that, no error field in email anymore.
Tahnks.
May be do you know, how can I get translated value of custom field to email?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @ypertsov ,
<tr> - string in table
<th></th>
<td>
<th> </th> - head inside cell?
<td></a></td>-where open tag a? Cell inside cell?
</td>
</tr>
Not sure that problem in tags, but try repair it.
B.R.
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.