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
Micheal MitchellMicheal Mitchell 

Email Template V.2

Hello Everyone,

I am fairly new to Salesforce. I have encounter this issue and would like to see, is there anyone that can help me with this roadblock that I have encounter? Is there any documents, videos or anyone who can help me with pertaining to how to run a query to find email templates that contain a certain string ex: Pasta that would also include the subject line and content, and trigger if possible
Best Answer chosen by Micheal Mitchell
Manj_SFDCManj_SFDC
Hello Micheal ,
you can use SOQL to fetch email templates 
EmailTemplate etId = [Select id, from EmailTemplate where name = 'email template name'];
however this wont help you in searching for a certain string in an email body  because it is a long text field, it cannot be filtered better approach is to export all templates and do a quick search using eclipse IDE or Workbench and do a search.
If you use the Workbench (https://workbench.developerforce.com),  you can select the SOQL Query option from the Queries menu and then run a SOQL on the EmailTemplate object or you can also use dataloader to export the email templates in csv format.
good luck !

All Answers

Manj_SFDCManj_SFDC
Hello Micheal ,
you can use SOQL to fetch email templates 
EmailTemplate etId = [Select id, from EmailTemplate where name = 'email template name'];
however this wont help you in searching for a certain string in an email body  because it is a long text field, it cannot be filtered better approach is to export all templates and do a quick search using eclipse IDE or Workbench and do a search.
If you use the Workbench (https://workbench.developerforce.com),  you can select the SOQL Query option from the Queries menu and then run a SOQL on the EmailTemplate object or you can also use dataloader to export the email templates in csv format.
good luck !
This was selected as the best answer
Manj_SFDCManj_SFDC
please mark the question as solved if the response helped you , thanks !