+ 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.

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