I am working on a custom template picker component which filters/restricts templates available to users. The email form is in a child object which the template picker writes to using an aura method. The available templates are listed in the component in an aura:iteration as follows:

<aura:iteration items="{!v.emailTemplates}" var="emailTemplate">
    <a class="emailTemplate-name" onclick="{!c.fillFromTemplate}" data-subject="{!emailTemplate.Subject}" data-body="{!emailTemplate.body}" data-sfid="!emailTemplate.Id}"> 

However, I haven't been able to pass the emailTemplate body attribute, a text area/blob, which arrives at the controller as "undefined." I tried passing the entire record, but it arrives at the controller stringified as [object Object]. What's the best way to fill in my email body form with the template text and code once a user clicks on a template link? I could just retrieve the emailTemplate Name and ID and then make a second SOQL query to retrieve the emailTemplate Body but this seems inefficient.

Thanks in advance for your help.


1 Answer 1


JavaScript, and therefore Lightning, is cAsE-sEnSiTiVe. The correct field name is Body, not body.

<a class="emailTemplate-name" 
  • @Cleverlemming You're welcome!
    – sfdcfox
    Commented Jan 14, 2019 at 8:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .