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
turbobuickturbobuick 

How do I use Support.EmailTemplateSelector?

Hi All - so we're looking at possibly rolling out a custom email publisher for use on the CaseFeed that would leverage the <apex:emailPublisher> functionality.

 

In conjunction with that, I'm trying to create an Apex class to use for Email Template selection and enable it for the Enable default email templates feature located in Support Settings. I've referenced the documentation and nearly copied the example code provided here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_email_template_selector_example.htm but I'm receiving the following error in Eclipse for my code: Save error: Invalid type: Support.EmailTemplateSelector

 

Here's my code - what am I missing?

 

global class CaseEmailTemplateSelector implements Support.EmailTemplateSelector {
	
	// Empty constructor
	global CaseEmailTemplateSelector() {  }
	
	global ID getDefaultEmailTemplateId(ID caseId) {
		// Get the current Case
		Case c = [SELECT Id, Subject FROM Case WHERE Id = :c.Id];
	
	EmailTemplate et;
	
		// For Support Record Type, use the Support Case Response email template
		if(c.RecordTypeId == System.Label.Case_Support_Record_Type_ID) {
			et = [SELECT Id 
					FROM EmailTemplate 
					WHERE DeveloperName = 'Support_Rep_Case_Response_Shell_HTML'];
		}
		
		return et.id;
	
	}

}

 

 

Best Answer chosen by turbobuick
turbobuickturbobuick

Hi there,

 

Thanks for the feedback - I actually discovered that we had a class titled "support" which was interfering with the ability to call Support.EmailTemplateSelector so the class is now saving properly.

 

Unfortunately, I'm not seeing it work in my environment. When opening up the standard or custom Email Publisher, the email template is not being loaded. Anyone have any thoughts as to what I should double check?

All Answers

digamber.prasaddigamber.prasad

Hi,

 

By looking at error log, looks like your eclipse is not updated since long for API version. Could you please try to save the same in salesforce through UI.

turbobuickturbobuick

Hi there,

 

Thanks for the feedback - I actually discovered that we had a class titled "support" which was interfering with the ability to call Support.EmailTemplateSelector so the class is now saving properly.

 

Unfortunately, I'm not seeing it work in my environment. When opening up the standard or custom Email Publisher, the email template is not being loaded. Anyone have any thoughts as to what I should double check?

This was selected as the best answer
Lara J WasowskiLara J Wasowski
Did you ever figure this one out?  I am trying to do the same thing, although the specified template is showing up if I use the default email publisher (and not the custom one I developed)
Ehsan YazdjerdiEhsan Yazdjerdi
Can anybody provide the code for an apex cless for Default Email Templates which simply just select a specific template name for all the emails sent from Case Feed Email publisher? There is no other criteria; we just have one template which we want our support agents use that for all the case responses from Case Feed Email. Thank you. 
Ido Greenbaum 10Ido Greenbaum 10
Hey all, 

If anybody needs any assistance, I was able to succesfully implement the Default Template Switcher (per this blog post (https://www.salesforce.com/blog/2012/10/case-feeds-smart-template-sample-implementation.html)), and willing to assist. 
A quick note though - it seems that the Template is only set once, and doesn't populate when re-composing an email in the Publisher / selecting to 'Reply' or 'ReplyAll'. I am still trying to figure out how to workaround this. 

Thank you, 
Ido.