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
ketan mehtaketan mehta 

Apex - Send mail and create a task for custom entity

Hi All,
   I am sending a mail by using "Messaging.SingleEmailMessage" entity. I want to a task to be created and available under "Activity History" section of any entity.

Thanks in advance.


SravsSravs
Bhawani SharmaBhawani Sharma
Make sure you choose the contact record for sending email and then use setSaveAsActivity method.