Newer Version Available
EmailTemplateSelector Interface
Support.EmailTemplateSelector works only in Salesforce Classic, not in Lightning Experience. Lightning Experience users can specify default values for emails using the QuickActionDefaultsHandler interface.
Namespace
To specify default templates, you must create a class that implements Support.EmailTemplateSelector.
When you implement this interface, provide an empty parameterless constructor.
EmailTemplateSelector Example Implementation
This is an example implementation of the Support.EmailTemplateSelector interface.
The getDefaultEmailTemplateId method implementation retrieves the subject and description of the case corresponding to the specified case ID. Next, it selects an email template based on the case subject and returns the email template ID.
The following example tests the above code: