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
Vandy7Vandy7 

Accessing E-mail Template

Hello everyone,

 

 

I am a newbie to force.com platform.Can anyone suggest me the code for accessing email template through command button in visualforce page.

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
WesNolte__cWesNolte__c

Hey

 

Depends on which template type you're using e.g. visualforce, html?

 

The fetch the template you query it as you would with other object records i.e.

 

EmailTemplate et = [select Id,Name,Subject,body from EmailTemplate where developername = 'mytemplate']

 

Wes

All Answers

WesNolte__cWesNolte__c

Hey

 

Depends on which template type you're using e.g. visualforce, html?

 

The fetch the template you query it as you would with other object records i.e.

 

EmailTemplate et = [select Id,Name,Subject,body from EmailTemplate where developername = 'mytemplate']

 

Wes

This was selected as the best answer
Vandy7Vandy7

Thanks Wes for your reply

.But I want to access it through a command button in a visualforce page.I want to select one of the templates in the folder when i click on the command button(Named-SELECT TEMPLATE) used in my code.

 

 

Is there a method to do this?

WesNolte__cWesNolte__c

Hey

 

You'll need the code somewhere in the action method or in the page initialisation. What is the user flow from end to end e.g.

 

1. Person clicks button called 'Select Template'.

2. Popup window appears with options.

3. User selects options from picklist

4. etc.....

 

Wes

 

Vandy7Vandy7

Thank you,

 

That worked well.