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

  • Gourav

    April 26, 2016 at 8:48 am

    Hi Ravi

    You can use 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:-      /{!}/e?setupid=CommunicationTemplatesEmail&retURL=%2F{!}
    • HTML/Custom:-      /p/email/template/EmailTemplateEditorUi/e?setupid=CommunicationTemplatesEmail&retURL=%2F{!}&TemplateType=1&id={!}
    • Visualforce:-       /email/template/editVFEmailTemplate.apexp?setupid=CommunicationTemplatesEmail&id={!}