+ Start a Discussion
manav_mnvmanav_mnv 

Edit Email template

Is it possible to edit the email templates which we define in Salesforce. I want to edit the HTML Email template and send further.
Please suggest how to achieve this.
Best Answer chosen by manav_mnv
Anupam RastogiAnupam Rastogi
Hi Manav,

You can use the following line of code to retrieve the current HTML Value of the Email Template that you wish to modify before sending it further.
Once you get the initial HTML value you can manipulate it as required and then send the email.
String TemplateName = 'XXXXX'; //--- Provide the Email Template Name here which needs to be modified
EmailTemplate et = [select Id, HtmlValue from EmailTemplate where DeveloperName = :TemplateName];

String ModifiedBody = et.HTMLValue; //--- Now you can modify the body which is present in ModifiedBody appropriately
Thanks
AR

If your problem is resolved by this reply then please mark it as best answer.
 

All Answers

Anupam RastogiAnupam Rastogi
Hi Manav,

You can use the following line of code to retrieve the current HTML Value of the Email Template that you wish to modify before sending it further.
Once you get the initial HTML value you can manipulate it as required and then send the email.
String TemplateName = 'XXXXX'; //--- Provide the Email Template Name here which needs to be modified
EmailTemplate et = [select Id, HtmlValue from EmailTemplate where DeveloperName = :TemplateName];

String ModifiedBody = et.HTMLValue; //--- Now you can modify the body which is present in ModifiedBody appropriately
Thanks
AR

If your problem is resolved by this reply then please mark it as best answer.
 
This was selected as the best answer
Mudasir WaniMudasir Wani
Hello Manav,

Yes you can edit the email template.

Administration Setup---->Communication Templates ---> Email Templates

And select the email template you want to update and made the changes and save.

You are done !!!!!!!!!!!

Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can helpn
 
David Roberts 4David Roberts 4
Hi Anupan,
Sounds interesting but where do you use this code?
Will this allow editing of the template as you are composing an email?
Regards,
Dave.
Anil ChinniahAnil Chinniah
OK.  None of this is helping me.  Where is "Adminitration Setup"?  and do I have to use code to accomplish this?  If so, where is that entered?  When I go to "Set Up" and I see an option for "Email" there, but when I click it (or not), the whole program crashes and kicks me back to a login screen.... :(  HELP please!