You need to sign in to do that
Don't have an account?
GGill31
Pre Populating Body and Subject from Email Template into Subject and Body using aura components
Hi,
I am a beginner in lightning components. I have a requirement to preview an email before sending it to users, contacts through Lightning aura components. I am trying to pre populate the email body with the HTMLEmailTemplate body text. I am querying the EmailTemplate object (et) to fetch the id, subject, body and passing that template id, body in the Messaging.SingleEmailMessage.setTemplateId(et.Id), Messaging.SingleEmailMessage.setSubject(et.Subject), Messaging.SingleEmailMessage.setBody(et.Body). It does not pre populate the Subject and Body content from the template into the component (can't see it). However, it sends the email with the template subject and body (when I check the email just received, it has the template content). My query is how can i pre populate the template content so that I can visualize it before sending and I can add something(customize) into it, if I want to. Any help would be appreciated. Thanks.
I am a beginner in lightning components. I have a requirement to preview an email before sending it to users, contacts through Lightning aura components. I am trying to pre populate the email body with the HTMLEmailTemplate body text. I am querying the EmailTemplate object (et) to fetch the id, subject, body and passing that template id, body in the Messaging.SingleEmailMessage.setTemplateId(et.Id), Messaging.SingleEmailMessage.setSubject(et.Subject), Messaging.SingleEmailMessage.setBody(et.Body). It does not pre populate the Subject and Body content from the template into the component (can't see it). However, it sends the email with the template subject and body (when I check the email just received, it has the template content). My query is how can i pre populate the template content so that I can visualize it before sending and I can add something(customize) into it, if I want to. Any help would be appreciated. Thanks.
Try the suggestion as mentioned in the below blog,
https://salesforce.stackexchange.com/questions/264864/lightning-record-action-to-open-prepopulated-mail-in-users-client/264872
It might help you.
Thanks!
Thanks for your reply. Good to know the approach you shared. My requirement is different though. I have an email template which i want to get prepopulated in the email body. I’m unable to have my email template pre populated in the email body of the component. My component can select any contact or user from a list as a recipient and it can attach any related file from the record. I want the email body to get pre populated with email template with merged fields, so that I can preview the final email content before sending and I can customize the email body by adding or removing some content from the final email template text displayed in the email body of the component.
Thanks