function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nani SircillaNani Sircilla 

display email template content whenever i select the one email template

Hi All,

My requirement is:
1). open the popup window of email templates whenever i click on the custom button and self close after selecting the one of those email templates.
2). Display the selected email template subject name in the text box and display the body of template in text area.

here, i have created custom pageBlockTable of standard templates.
check it once.. VF page:
 
<apex:page controller="ViewEmailController" showHeader="false" id="pg">  
    <script>
        function getTemplateId(me){
        //var etname = document.getElementById('pg:frm:pb:pbt:id').value;
           //return document.getElementById('id').value = etname;
           alert('hi');
            //alert(document.getElementById('pg:frm:pb:pbt:id:etname');
        }
    </script>
    
    <apex:form id="frm">  
     <apex:pageBlock title="Email Templates" id="pb">  
       <apex:pageBlockTable value="{!emailTemplates}" var="et" id="pbt">  
         
         <apex:column headervalue="Template Name" id="clm">
             <apex:outputLink value="{!et.Id}" onclick="getTemplateId(this)" id="id">
                 <apex:outputText value="{!et.Name}" id="etname"/>
             </apex:outputLink>
          </apex:column>
         <apex:column headervalue="Type" value="{!et.TemplateType}" />
         <apex:column headerValue="Description" value="{!et.Description}"/>
       </apex:pageBlockTable>
       
     </apex:pageBlock>  
    </apex:form>
    
</apex:page>
Controller:
public class ViewEmailController  
 {
     public List<EmailTemplate> emailTemplates;
     public String templateName;
    public ViewEmailController() {
        
    }

    public ViewEmailController(ApexPages.StandardController controller) {

    }
     
   public List<EmailTemplate> getEmailTemplates()  
   {   
       emailTemplates=[SELECT Id, Name, TemplateType, Description from EmailTemplate];  
      
     return emailTemplates;  
   }
    
 }
my requirement look like this:image

Could u pls anyone help me.
Thank you.