+ Start a Discussion
RitikRitik 

display and edit emailTemplate on visualforce page

Hello,
I have a requirement wherein I have to send mail to list of users with appropriate email template. 
But, the end-user who will send mail (on click of a button) should see the template on a page and should also be able to edit it (if required). 
i.e the email template should be displayed in an input text.

For this I have created a vf page with a class. 

Here I am able to query all email tempaltes in the org.
I have used below quries
Query1:
SELECT Body, BrandTemplateId, Description, DeveloperName, FolderId, Folder.DeveloperName , HtmlValue, 
        Id, IsActive, Markup, Name, Subject, TemplateStyle, TemplateType, 
FROM EmailTemplate

AND

Query2:
select id, name, value from BrandTemplate


But still I am not able to display the template as is in vf page.


Please help.
Do let me know if any futher clarification is required.


Thanks,
Ritik
Shashi PatowaryShashi Patowary
Hi Ritik,

Instead you can think of designing a VF page with user's inputs and then send this page as attachment in a mail. You will get good eaxample at this link -

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_sending_attachments.htm

Please let me know if this is helpful.

Regards,
Shashi
RitikRitik
Hello Shashi,

Thanks for your reply.

But I cannot change the requirement and I have to display the template on vf page and it should be editable on the fly.

Anybody any suggestion??


Thanks and Regards,
Ritik
Shashi PatowaryShashi Patowary
Hi Ritik,

I don't think so that it is possible to load a VF template in vf page.Let's have some expert comments here as well.
Instead, as I suggested, you can render your VF page to look like the template and user can give inputs before sending mail.

Please let me know if you get more information on this.

regards,
Shashi