Find your content:

Search form

You are here

Create an Activity history when email is sent from VF page


My requirement is to send the email with customized body when the user clicks on a button in the detail page layout.

I have a custom button in the detail page layout. When user clicks on the button, a VF page is displayed with the email body content. In this VF page, I have two buttons. One for editing the email body and one to send the email to the users. When the user clicks on send email button, the email is sent from VF page.

Is there any way to log this email sent in the Activity History table?

As of now, I have an idea to create a note as a history with the details like from address, toaddress,ccaddress and bccaddress.

Thanks in advance.

Attribution to: Priyanka

Possible Suggestion/Solution #1

From the docs:

setSaveAsActivity: Optional. The default value is true, meaning the email is saved as an activity. This argument only applies if the recipient list is based on targetObjectId or targetObjectIds. If HTML email tracking is enabled for the organization, you will be able to track open rates.

If you want to do anything fancier, you have to roll your own solution.

Attribution to: jkraybill
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content