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

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

This widget could not be displayed.
Henning Tietgens Community Champion Mar 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

Thank you

my custom field is now showing correctly

but it contains the following brackets

[] e.g [custom field]

Henning Tietgens Community Champion Mar 18, 2013

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

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

because getCustomFieldValue returns an Option object

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 Community Champion Mar 18, 2013

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

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 Community Champion Mar 19, 2013

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

Henning Tietgens Community Champion Mar 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

that worked thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 4 hours ago in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

18 views 0 1
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