I'm trying to add a custom field value to the create issue HTML email template, but stumbling. The field is required, so there will always be a value present on issue creation.
Attempt 1:
I've followed the directions here: https://developer.atlassian.com/server/jira/platform/adding-custom-fields-to-email/?_ga=2.56485292.608403254.1563807890-1574526416.1556543036
When I add the customerfield.vm as indicated below
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_15707"))
#if($issue.getCustomFieldValue($customfield))
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
$textutils.htmlEncode($issue.getCustomFieldValue($customfield), false)
</td>
</tr>
#end
Instead of the comma separated values of the field, I get this message: $textutils.htmlEncode($issue.getCustomFieldValue($customfield), false)
Attempt 2:
I tried the suggestion in another article, but instead of the value, I get the label name a second time.
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_15707"))
#set ($customfieldvalue = $customfield.getValue($issue))
#if($customfieldvalue)
<tr>
<th>#text($customfield.name):</th>
<th>$customfield</th>
</tr>
#end
and tried
#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_15707"))
#set ($customfieldvalue = $customfield.getValue($issue))
#if($customfieldvalue)
<tr>
<th>#text($customfield.name):</th>
<th>$customfieldvalue</th>
</tr>
#end
I can't tell if my issue is coming from the createissue.vm or customfield.vm or how to fix it. any help/suggestions would be very much appreciated!
Hi Josh,
Could I check where you will be storing the flagged value as you have tagged lots of different plugins above.
However if you want to use Script Runner then you could create a Script Field which returns a number return type to show when an issue is flagged using the example code below.
// Get the Values of the Flagged Field
def flag = getCustomFieldValue("Flagged")
// Return 1 if the Flagged field is set and not null else return 0
if (flag) {
return 1;
}else{
return 0;
}As for detecting if the issue was previously flagged then you would want to look at using some code similar to the example here to check the issue change history.
I hope this helps
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.