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
Rakesh SRakesh S 

display list of email templates in visualforce page

Hi all,

I have an requirement to display list of email templates in visualforce.
like this display list of email templates
i want to do this using apex. can you please suggest, how can i do...


Thank you.
Rakesh
kumar tanwarkumar tanwar
Hello Rakesh,
Please see below link to show EmailTemplete in VF Page..
http://stackoverflow.com/questions/11117846/accessing-email-templates-in-visualforce
Thanks..
surasura
In addtion to kumar's post refer below link to findout available fields and more on EmailTemplate object

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_emailtemplate.htm#topic-title
ManojjenaManojjena
Hi Rakesh ,
Your requirement is not so complex ,You need to do a simple query from EmailTemplate Object and needs to display in VF page .
If you want to display template from aparticular folder then above link will help .As we are storing template inside a folder always .
Again Folder is also an Object in salesforce you can query like template in salesforce and add filter as per your requirment .

Try with below code it will help !
 
public class DisplayEmailTemplate {
Public List<EmailTemplate> tempList{get;set;}
public DisplayEmailTemplate(){
tempList=new List<EmailTemplate>();
 tempList=[ SELECT Name,Subject,TemplateType,Description FROM EmailTemplate];
  }
}
///////////////////////////////
<apex:page controller="DisplayEmailTemplate">
	<apex:form>
       <apex:pageBlock>
	     <apex:pageBlockTable value="{!tempList}" var="temRec">
			<apex:column  value="{!temRec.Name}" headerValue="Name"/>
			<apex:column  value="{!temRec.TemplateType}" headerValue="Subject"/>
			<apex:column  value="{!temRec.Description}" headerValue="Description"/>
		 </apex:pageBlockTable>
	   </apex:pageBlock>
	</apex:form>
</apex:page>
Thnaks
Manoj