• Lara J Wasowski
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Capgemini

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I have built a custom VF page for a "Send Email" action from the Case Feed layout.  The main reason for doing this was to get at the "Supplied Email" as the default "To:" address.  Have run into two problems:
  1. I would like to include the email address of the Contact linked to the case, but I can't figure out how to reference it, given that I am using the Case Standard Controller.
  2. Also, is there any way to specify a default email template from this page?
    <apex:page standardController="Case" >
    <apex:emailPublisher entityId="{!case.id}"
    width="100%"
    fromVisibility="selectable"
    fromAddresses="customerservice@XYYYX.no, kundeservice@XYYYX.no"
    subjectVisibility="readOnly"
    subject="Re: {!case.subject}"
    expandableHeader="true"
    enableQuickText="true"
    verticalResize="true"
    showTemplates="true"
    emailbodyFormat="HTML"
    toAddresses="{!case.suppliedemail}"
    autoCollapseBody="false"
    emailBody=""/>
    
    </apex:page>
Original problem: I wanted to be able to send an email to the Web Email OR Contact email from the Case Feed.

Initial solution: I've created a custom email publisher action calling a Visualforce Page where I specify the case.suppliedemail as the ToAddress.  Here I have also specified verticalResize to True, so that once I select a template the user can resize the editor window in order to edit the text etc.
<apex:page standardController="Case" >
<apex:emailPublisher entityId="{!case.id}"
width="100%"
fromVisibility="selectable"
subjectVisibility="readOnly"
subject="Re: {!case.subject}"
expandableHeader="true"
enableQuickText="true"
verticalResize="true"
showTemplates="true"
emailbodyFormat="HTML"
toAddresses="{!case.suppliedemail}"
emailBody=""/>
</apex:page>
Current problems:
  • after I select a template, the header on the email automatically expands, which means that the user has to minimize the header before they can see the "Send Email" button again.  
  • The email editor isn't filling 100% of the action window, even though I have specified width="100%"
  • Neither of these are problems with the standard email publisher action!
User-added image
User-added image

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;
	
	}

}