Hello Everyone ,
I created a class to have email template depending of the case origin for my send email quick action, then I add that class to be use within the support settings, but it is not functioning, anyone have an idea why? Thanks in Advance
global class CaseEmailTemplateSelector implements Support.EmailTemplateSelector {
// Empty constructor
global CaseEmailTemplateSelector() {}
global ID getDefaultEmailTemplateId(ID caseId) {
// Get the case record
Case c = [SELECT Origin FROM Case WHERE Id = :caseId];
// Select the appropriate email template based on case origin
String templateDeveloperName;
if (c.Origin == 'Billing DE') {
templateDeveloperName = 'Template quick text';
} else if (c.Origin == 'Support DE') {
templateDeveloperName = 'Template quick text';
} else if (c.Origin == 'Service DE') {
templateDeveloperName = 'Template quick text';
} else {
// Default template for other origins
templateDeveloperName = 'QT DE Signature';
}
// Query for the email template using the developer name
EmailTemplate template = [SELECT Id FROM EmailTemplate WHERE DeveloperName = :templateDeveloperName LIMIT 1];
// Return the ID of the selected email template
return template.Id;
}
}
Origin is the standard field , so it's the right syntax.
It does not trigger, i will check logs maybe i can see something there.
thanks for the support