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}