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
Animesh DattaAnimesh Datta 

EmailMessage customization

I have Custom Email button in a Custom object. I am using standard emailAuthor page in this button. After sending email using buttton, Activity history of Case is getting updated with the email. For this I have written a trigger on Activity to swap activity. Now I need to populate the Email relatedlist of case also while sending email from the custom button of custom object. Here Case is lookup in the custom object.

Kindly help!!!!!

SonamSonam (Salesforce Developers) 
Hi Animesh,

I am thinking the following could help you achieve this:
Create a trigger on Task object such that when ever an email is sent from custom object, a record is created in EmailMessage Object whih is related to the case associated to the custom object record:
something similar with code: