I am trying to enable the default email template selection logic as per the salesforce provided document - https://help.salesforce.com/articleView?id=case_interaction_default_templates.htm&type=5
But I am not able to get the predefined email template in my case feed in salesforce classic . I have already selected Enable default email templates and my template selection logic class in support settings. Can some one guide me what is wrong here and how we can proceed
global class MyCaseTemplateChooser implements Support.EmailTemplateSelector {
// Empty constructor
global MyCaseTemplateChooser() { }
// The main interface method
global ID getDefaultEmailTemplateId(ID caseId)
{
system.debug('Login User Role : '+userRole);
// Select the case we're interested in, choosing any fields that are relevant to our decision
Case c = [SELECT Subject, Description, Recordtype.Name, RecordTypeId, FROM Case WHERE Id = :caseId];
system.debug('CASE****'+c);
EmailTemplate et;
if (c.RecordType.Name.contains('Support Case') )
{
system.debug('Entered in If loop to select Template');
et = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'MyTestTemplate'];
system.debug('EmailTemplate*** :'+et.Name);
}
return et.id;
}
}