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
aparkmanaparkman 

apex:emailPublisher to include email templates and attachments

I am trying to do some customization to the case feed so that I can default the email template based on a field on the case, and also attach any attachments from the case to the email. I have found that I can use the apex:emailPublisher Visualforce tag to create a VF page I can use in a custom action, but out of all the documentation I've read, I don't see anything saying how to set a default template, or add attachments. I'm assuming I would need to do this in a controller. Has anyone had any experience with using the apex:emailPublisher tag and using a controller to include more functionality into an email action?

One thing to note - I'd like to stay away from have apex actually sent emails, as we are not that far away from reaching the single email limits per day. I just want to default the email so all the user has to do is click send.

I also need this to send through the email message object so that email to case can still be used so replies will be attached to the case.
scottbcovertscottbcovert

Hi Aparkman,

I'm not sure about having a default template automatically selected, but according to this documentation page (https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/case_feed_dev_guide_email_publisher.htm) it looks like there is an attribute for 'showAttachments' and 'showTemplates' that can be set to true to display the attachment and template selectors.

Best,
Scott