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
Aam MAam M 

How to autopoulate email in To Address ?

I've a requirement of auto fetching email address in "To" Field when I click Send Email button in Activity History of Account, Any solution?

And If I've multiple Contacts in Account, And I want to send that email to Primary Contact. So I want to populate primary contact email in To field.

Please provide some idea.
In order to answer your question, let us first consider the main Idea i.e. URL of send email page which is
User-added image
The “p2_lkid” is the “To” filed html id and “003xxxxxxxxx” is the contact id whose email address would be used to send email.
Now, Come to the solution of your question.
  1. Create a new filed on account object that will keep the primary contact id. It should be lookup of contact object and should be updated once primary contact would change for that account.
  2. Create a task custom button from this below navigation path
User-added image
        3.  The custom button should have selected/entered URL as below 
User-added image
         4. Go to the account page layout and Change the Activity History related list as bleow
User-added image