Custom fields in outgoing HTML issueassign.vm do not show proper data in Email

I have created several custom fields in Jira -

  • Assigned Group (Group Picker)
  • Customer (User Picker)
  • Planned Start (Date Picker)

I have added these fields to outgoing HTML emails (issueassigned.vm) and I have also created the corresponding fields (assignedgroup.vm, customer.vm and plannedstart.vm)

When the email is sent out, the data in the email does not match the true data values.
For Example -
Assigned Group: [com.atlassian.crowd.embedded.impl.ImmutableGroup@14cd6]
(This should be Uno for the Group Name)

Customer: aarockia:10001
(This should be Arockiasamy, Anthony)

Planned Start: 2013-05-11 00:00:00.0
(This Should be 05/11/13 12:00 AM)

8 answers

1 accepted

This widget could not be displayed.

$issue.getCustomFieldValue("customfield_11000").get(0).name

works for the assigned group

This widget could not be displayed.

Here is a sample of the assignedgroup.vm file -

#disable_html_escaping()

#if ($issue.getCustomFieldValue("customfield_11207"))

<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};">#text("Assigned Group"):</strong>

</td>

<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">

$issue.getCustomFieldValue("customfield_11207")

</td>

#end

</tr>

This widget could not be displayed.

And here is the issueassigned.vm -

#parse("templates/email/html/includes/fields/assignedgroup.vm")

This widget could not be displayed.
Please try it with $ issue.getCustomFieldValue ("abc").getValue ();

I tried this setup -

#disable_html_escaping()
#if ($issue.getCustomFieldValue("customfield_11207"))
<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};">#text("Assigned Group"):</strong>
</td>
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
$issue.getCustomFieldValue("customfield_11207").getValue();
</td>
#end
</tr>

And it does not work.

This widget could not be displayed.

Try 'getDisplayName()'

Following worked for me, for multi-user custom fields. You can try the same for group picker too:

#if($issue.getCustomFieldValue("customfield_xxxxx"))#foreach($c_p in $issue.getCustomFieldValue("customfield_xxxxx"))$c_p.getDisplayName()#if($velocityCount != $issue.getCustomFieldValue("customfield_xxxxx").size()), #end#end#{else}Not Specified#end

(replace 'customfield_xxxxx' with the actual text ID of the required custom field in your instance)

For date picker you can use the dateformatter,

#if($issue.getCustomFieldValue("customfield_xxxxx"))$dateformatter.formatDateTimePicker($issue.getCustomFieldValue("customfield_xxxxx"))#{else}Not specified#end

Refer to Atlassian's developer documentation and javadocs for more information. (Google them)

Also, following question might be helpful:

https://answers.atlassian.com/questions/154833/velocity-how-to-get-user-ids-in-a-multi-user-custom-field-into-a-comma-separated-string

I tried this setup -

#disable_html_escaping()
#if($issue.getCustomFieldValue("customfield_10308"))$dateformatter.formatDateTimePicker($issue.getCustomFieldValue("customfield_10308"))#{else}Not specified#end

and it does not work

I hope you already know how to make VM teplate changes effective without restarting JIRA.

Then, do the following,

  1. Go to JIRA Administration --> Mail Queue
  2. Flush Mail Queue once to make sure there's no pending delivery
  3. Make changes and save the template file.
  4. Refresh Mail Queue. What do you see? Normally there should be one or several mail messages queued. Also, if each item begins with text 'ERROR:', then again there's a problem.
  5. Flush the Mail Queue. Wait a minute and two and check your inbox. If you have received an e-mail with a big stacktrace (error log kind of thing), paste it here so we can look at the problem.

All I am missing is the Group Picker.... Any idea how this is formated?

Using the following type of format I got the user picker and the date to work properly... now I'm just missing the Group Picker custom field

#authorlink($issue.getCustomFieldValue("customfield_10094").name)

This widget could not be displayed.

I got the Custom user field to show properly in the email by using -

#disable_html_escaping()
#if ($issue.getCustomFieldValue("customfield_11400"))
<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};">#text("Customer"):</strong>
</td>
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
#authorlink($issue.getCustomFieldValue("customfield_11400").name)
</td>
#end
</tr>

This widget could not be displayed.

All I am missing is the Group Picker.... Any idea how this is formated?

This widget could not be displayed.

I got the date to work as well with the following -

#disable_html_escaping()
#if ($issue.getCustomFieldValue("customfield_10308"))
<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};">#text("Planned Start"):</strong>
</td>
<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
$dateformatter.formatDMYHMS($issue.getCustomFieldValue("customfield_10308"))
</td>
#end
</tr>

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

232 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you