I'm trying to add a custom label field to the subject line of workflow transition event emails. I've created a new email template for this and it's successfully sending me emails unfortunatly I can't get the custom label values to show up. The code for the subject line is:
#disable_html_escaping()
#set($cFieldValue=$issue.customFieldManager.getCustomFieldObject("customfield_10064"))
($issue.key) $issue.summary - $issue.getCustomFieldValue($cField).getValue()
When I get the email I get this in the subject line:
JIRA DB (LER-7) Test - $issue.getCustomFieldValue($cField)
I've tried several other methods that I've found to try and get the fields value with no luck. How do I get JIRA to send the value instead of this?
@Theodore Adams -
JIRA Version?
Did you follow (roughly at least) the instructions on this page?
I haven't played with labels much (yet) so I don't know if there are tricks to retrieve and set them, but here's the code from that page where they are setting a custom field and referencing it in the notification:
#if ($issue.getCustomFieldValue("customfield_10000")) $stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize): $issue.getCustomFieldValue("customfield_10000") #end
From what I've seen you typically get the variable reference (what you are currently seeing) instead of the variable value when the routine is returning NULL. I'd first modify your notification template hard-coding in a returned value OR just check the returned value for null and return a different string instead.
-wc
And as Nic has pointed out in another post: * https://confluence.atlassian.com/display/JIRA/Customizing+Email+Content
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apparently I was being an idiot yesterday, the issue I was testing with didn't have that custom filed populated. Once I did it worked. I've added the logic you suggested to check to see if it has a value. Got it working now. I do have another question though. I'm trying to add the same field to the body of the email. I'm editing changelog.vm and added a section to the bottom. For some reason I can't seem to get the field name to bold like the rest of the items in the email. Code is below: #* @vtlvariable name="changelog" type="org.ofbiz.core.entity.GenericValue" *# #disable_html_escaping() #if ($changelog) <table class="keyvalue-table"> #if ($worklog) #parse('templates/email/html/includes/patterns/worklog-row.vm') #end <tr> <th>#text("template.change.by"):</th> <td> #if ($changelogauthor) #authorlinkkey($changelogauthor.key $linkstyle) #elseif ($changelogmetadata.actor) #emailHistoryMetadataParticipant($changelogmetadata.actor, true) #else #text("common.words.anonymous") #end </td> </tr> #foreach ($changeitem in $changelog.getRelated("ChildChangeItem")) #if ($changeitem.getString("field").equals("description")) #set ($changelogItemIssueDescription = $changeitem) #end #if(!$changeitem.getString("field").equals("WorklogTimeSpent") && !$changeitem.getString("field").equals("WorklogId") && !$changeitem.getString("field").equals("description")) <tr> <th>$textutils.htmlEncode($velocityhelper.getFieldName($changeitem, $i18n)):</th> <td> #if ($changeitem.getString("field") == "Comment") #set ($oldstringKey = "oldvalue") #set ($newstringKey = "newvalue") #else #set ($oldstringKey = "oldstring") #set ($newstringKey = "newstring") #end #set ($oldText = "") #set ($newText = "") #set ($oldText = $velocityhelper.getPrettyFieldString($changeitem.getString("field"), $changeitem.getString($oldstringKey), $i18n, "")) #set ($newText = $velocityhelper.getPrettyFieldString($changeitem.getString("field"), $changeitem.getString($newstringKey), $i18n, "")) $!diffutils.diff($oldText, "background-color:${auiErrorBackgroundColour};text-decoration:line-through;", $newText, "background-color:${auiSuccessBackgroundColour};") </td> </tr> #end #end #if ($issue.getCustomFieldValue("customfield_10064")) <tr> <th>$textutils.htmlEncode($issue.getCustomFieldObject("customfield_10064").name):</th> <td> $issue.getCustomFieldValue("customfield_10064") </td> </tr> #end </table> #end Any idea why the <th> tag doesn't seem to be working?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.