Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Organizations In Email Template Issue HTML

Steven McCaffrey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 10, 2020

Hello, 

We want to add the Custom Field Organizations to our Email Subject Line and Body. 

I've used many of the resources and while they've worked for other custom fields it has not worked for this particular one. Organizations is also LOCKED custom field if that matters. 

 

in the issuecreated.vm email notification this is what I have:

#disable_html_escaping()

#defaultMailHeader("email.event.activity.created.issue", $issue.reporter)

#set ($issueTitleBody="#parse('templates/email/html/includes/patterns/issue-title.vm')")
#rowWrapperNormal($issueTitleBody)


#rowWrapperNormalBegin('' 'wrapper-special-margin')
<table class="keyvalue-table">
#parse("templates/email/html/includes/fields/issuetype.vm")
#parse("templates/email/html/includes/fields/affectsversions.vm")
#parse("templates/email/html/includes/fields/assignee.vm")
#parse("templates/email/html/includes/fields/attachments.vm")
#parse("templates/email/html/includes/fields/components.vm")
#parse("templates/email/html/includes/fields/createddate.vm")
#parse("templates/email/html/includes/fields/duedate.vm")
#parse("templates/email/html/includes/fields/environment.vm")
#parse("templates/email/html/includes/fields/fixversions.vm")
#parse("templates/email/html/includes/fields/labels.vm")
#parse("templates/email/html/includes/fields/priority.vm")
#parse("templates/email/html/includes/fields/reporter.vm")
#parse("templates/email/html/includes/fields/securitylevel.vm")
#parse("templates/email/html/includes/fields/timetracking.vm")
#parse("templates/email/html/includes/fields/organization.vm")
#parse("templates/email/html/includes/fields/vendordetails_cf.vm")
</table>
#rowWrapperNormalEnd()

#if ($issue.description)
#set($textParagraph = $issue.htmlDescription)
#rowWrapperNormal("#parse('templates/email/html/includes/patterns/text-paragraph.vm')", '', 'issue-description-container')
#end

#set ($commentActionBody="#parse('templates/email/html/includes/patterns/comment-action.vm')")
#rowWrapperNormal($commentActionBody)

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

 

and for the organization.vm file I have:

#disable_html_escaping()
#set ($customfield = $customFieldManager.getCustomFieldObject("customfield_13401"))
#if($issue.getCustomFieldValue($customfield))
<tr>
<th>#text($customfield.name):</th>
<td class="has-icon">
$customFieldManager.getCustomFieldObject("customfield_13401").getValue($issue)
</td>
</tr>
#end 

 

 

The returned value I'm getting is [CustomerOrganizationImpl{id=307,name=Plaza Loans}]

What I'm hoping it would just return the name Plaza Loans. 

You'll notice there's #parse("templates/email/html/includes/fields/vendordetails_cf.vm") in the issuecreated.vm and the vendordetails_cf.vm is identical just with different custom field ID's and that one is working like a beauty. 

 

I used this resource since it's helped me the most so far: 
https://community.atlassian.com/t5/Jira-Core-questions/Add-Custom-Field-Value-to-Email-Template/qaq-p/1136371

 

 

I also 

0 answers

Suggest an answer

Log in or Sign up to answer