Newer Version Available

This content describes an older version of this product. View Latest

EmailTemplateSelector Interface

The Support.EmailTemplateSelector interface enables providing default email templates in Case Feed. With default email templates, specified email templates are preloaded for cases based on criteria such as case origin or subject.

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

Support

To specify default templates, you must create a class that implements Support.EmailTemplateSelector.

When you implement this interface, provide an empty parameterless constructor.

EmailTemplateSelector Methods

The following are methods for EmailTemplateSelector.

getDefaultTemplateId(caseId)

Returns the ID of the email template to preload for the case currently being viewed in the case feed using the specified case ID.

Signature

public ID getDefaultTemplateId(ID caseId)

Parameters

caseId
Type: ID

Return Value

Type: ID

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: