In Jira 5.0 we have several custom fields. These customizations have always worked in the past in the html emails. Code below now is just showing garbarge like [com.atlassian.crowd.embedded.ofbiz.OfBizUser@b6b373d2] for the value rather than the jira user name that's stored in the field via the multi user picker. The other custom fields show the correct data in the html email. Any idea on what's going on?
#if ($issue.getCustomFieldValue("customfield_10131"))
<tr valign="top">
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:${textSubtleColour};">
$stringUtils.leftPad($issue.getCustomField("customfield_10131").name, $padSize):
</strong>
</td>
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
$issue.getCustomFieldValue("customfield_10131")
</td>
</tr>
#end
Which bit is not working? It should be:
$issue.getCustomField("customfield_10131").name
which will prevent an error if the field has no value set. And are you sure this is a multi not a single user picker? This code should not work for a multi user picker. You need to iterate over the users calling .name on each one. I don't see how this worked previously.
In our Jira 4.2 production instance, below is the code that's in the issuessummary.vm for html templates and the email is showing the two users that were added to the issue as UAT asignments. I thought the same thing as well that it should have to be iterated through with a foreach..end statement. So I was just carrying the same change forward to 5.0. I can replace the code with the foreach..end statement but I'm not fully aware of the syntax for custom fields.
Email shows this:
UAT Assignments: [ceswift,tlking]
#if ($issue.getCustomFieldValue("customfield_10131"))
>$stringUtils.leftPad($issue.getCustomField("customfield_10131").name, $padSize): $issue.getCustomFieldValue("customfield_10131")
>
#end
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Terry, this is caused by a toString() overriden method. In Jira 5, this is missing and the default toString() method was called, producing the result you see.
So: either do what Jamie said, or "patch" jira class com.atlassian.crowd.embedded.ofbiz.OfBizUser with a nicer toString() method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's what I thought at first, but surely the value should be a collection of OfBizUsers, not one.
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 following in the issuecreated.vm for the html emails and it worked. Thanks.
#if ($issue.getCustomFieldValue("customfield_10131"))
<tr valign="top">
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:${textSubtleColour};">
$stringUtils.leftPad($issue.getCustomField("customfield_10131").name, $padSize):
</strong>
</td>
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
#foreach ($CustomField in $issue.getCustomFieldValue("customfield_10131"))
$CustomField.name,
#end
</td>
</tr>
#end
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.