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}">
{!emailTemplate.DeveloperName}
</a>
</aura:iteration>
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.