Activity Forums Salesforce® Discussions Edit an Email Template from a Visualforce page

  • Gourav

    Member
    April 26, 2016 at 8:48 am

    Hi Ravi

    You can use window.open() or location.replace() function in your JavaScript button to open selected email template in edit mode. But before call one of these function you have to identify the type of template because their are different URL to open Email template in edit mode.
    Basically their are 4 type of Email Template:-

    • Text
    • HTML (using Letterhead)
    • Custom (without using Letterhead)
    • Visualforce

    To identify your Email Template use this query:- 'select id,TemplateType from EmailTemplate'

    Once you identified the type of Email Template then you can pass the id of seleceted Email Template to the URL and open that in edit mode. Use these URLs for open that template in edit mode

    • Text:-      /{!EmailTemplate.id}/e?setupid=CommunicationTemplatesEmail&retURL=%2F{!EmailTemplate.id}
    • HTML/Custom:-      /p/email/template/EmailTemplateEditorUi/e?setupid=CommunicationTemplatesEmail&retURL=%2F{!EmailTemplate.id}&TemplateType=1&id={!EmailTemplate.id}
    • Visualforce:-       /email/template/editVFEmailTemplate.apexp?setupid=CommunicationTemplatesEmail&id={!EmailTemplate.id}
  • Ravi

    Member
    April 26, 2016 at 9:04 am

    Thanks Gourav for your help.

     

  • vishakha

    Member
    October 28, 2022 at 8:20 am

    To edit t and view the email template in Visualforce page refer this link, hope it helps https://help.salesforce.com/s/articleView?id=sf.admin_viewing_emailtemplates.htm&type=5

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos