for html need specfic examples of how to add custom field to every email notifcations

Fiona Gallagher March 14, 2013
Fiona Gallagher added a comment - 15/Mar/13 5:03 AM
tried to edit vm files
#if ($issue.getCustomFieldValue("customfield_10021")) $stringUtils.leftPad($issue.getCustomField("customfield_10021").name, $padSize): $issue.getCustomFieldValue("customfield_10021") #end

is what you would type if the email was in text format but what do you type if you wanted to edit every email in html format to show a custom field

1 answer

1 accepted

0 votes
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 14, 2013

You can take a look into the html/includes/fields directory to get some examples. Additionally it's a good idea to create a .vm there for your customfield and include it in the main templates.

Something like this

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

Henning

Fiona Gallagher March 18, 2013

Thank you

my custom field is now showing correctly

but it contains the following brackets

[] e.g [custom field]

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2013

If it's a Select Field or similar you must write

$issue.getCustomFieldValue("customfield_10075").getValue()

because getCustomFieldValue returns an Option object

Fiona Gallagher March 18, 2013

its a multiselect

this is what I tried but it doe not work

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

<tr valign="top">

<td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};text-align:left;padding:0 10px 10px 0;white-space:nowrap;">

<strong style="font-weight:normal;color:${textSubtleColour};">Client:</strong>

</td>

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

$issue.getCustomFieldValue("customfield_10021").getValue()

</td>

</tr>

#end

email returned

Issue Type: Bug Bug
Assignee: Aaran Heavey
Created: 19/Mar/13 4:40 PM
Description: test
Fix Versions: Unassigned
Project: FSiRM Live
Priority: Minor Minor
Reporter: Fiona Gallagher
Client: $issue.getCustomFieldValue("customfield_10021").getValue()
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2013

Could you try $issue.getCustomFieldValue("customfield_10021").join(", ") instead of ...getValue()?

Fiona Gallagher March 18, 2013

this didnt work either entered

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

$issue.getCustomFieldValue("customfield_10021").join(", ")

</td>

Issue Type: Bug Bug
Assignee: Aaran Heavey
Created: 19/Mar/13 5:11 PM
Description: test client
Fix Versions: Unassigned
Project: FSiRM Live
Priority: Minor Minor
Reporter: Fiona Gallagher
Client: $issue.getCustomFieldValue("customfield_10021").join(", ")
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2013

Ok, now you got me :-) I will try it by myself and get back.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2013

Ok... you could use something like this to get rid of the brackets:

#set ($mylisttext = $issue.getCustomFieldValue("customfield_15090").toString())
#set ($mylength = $mylisttext.length() - 1)
$mylisttext.subSequence(1,$mylength)

Henning

Fiona Gallagher March 19, 2013

that worked thanks

Suggest an answer

Log in or Sign up to answer