4

I want to implement Send an Email functionality for custom object(Currently send an email available for only Contact/Lead/Person Account).

  • Once we click on "Select Template" button it should open a new window with all the existing email templates
  • Once we select any one email template the subject and body should populate on subject and Body field in visualforce page.

Anyone have any idea on how to implement this functionality?

Mock Email template

1 Answer 1

3

All you want can be implemented with buttons, picklist, input texts and a reach text editor.

From the controller you can query the emails templates, then you can list the templates names in a picklist, once the user select an option in the picklist you can populate a reach text area with the body of the email template.

Rich text editor: <apex:inputTextArea richText="true" />

7
  • Hi Cruz thanks for your response,i implemented "select template" pick list and subject and body values are reflecting as expected but only personalization is not working in selected email template i.e {!Organization.Name} should display Myorganisation name but now it is displaying as {!Organization.Name}
    – ncmouli
    Commented Aug 3, 2016 at 9:26
  • Are you sending the email by invoking email.setTemplateId(templateId)? or are you setting the body manually? This issue is happening only when you display the body in your visualforce or also when you send the email? According whit your answers, I will update my solution.
    – D. Cruz
    Commented Aug 3, 2016 at 12:00
  • Hi Cruz,if we set email.setTemplateId(templateId) personalization is working fine thanks for your inputs.
    – ncmouli
    Commented Aug 3, 2016 at 12:35
  • is there a way to perform all these functionality by using command button.
    – ncmouli
    Commented Aug 3, 2016 at 12:36
  • Take into account that if you allow the user to edit the template body, then you will have to perform an UPDATE with that template. I you don´t, the email will we sent with the unmodified email template. What do you mean by perform this by command button? Saving the template and sending the email?
    – D. Cruz
    Commented Aug 3, 2016 at 12:47

You must log in to answer this question.

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