auto-populate the “Additional To” field when sending an email by “Send Email” Button on activity History

Few days back , I have a client requirement to “auto-populate the additional to field when sending an email by “Send Email” button click on activity History Related List of a Custom object”.
Actual need is to populate “To” field , but I could not able find any solutions for that.
After doing google search, I got a solution to auto-populate the Additional-To field

Solution:
1. It may not possible to override “SendEmail” button of activity History, also not able to add a New Button in activity History Related List
2. As a alternative way, Add a New Button in Custom Object Detail Page.
3. Call the following URL & open that URL page

/_ui/core/email/author/EmailAuthor?rtype=003&p3_lkid={!MyObject__c.Id}&retURL={!MyObject__c.Id}&p24={!MyObject__c.<Email field API Name>}

4. Add the Button to the page layout.

5. Click on the link and it navigates you to the email page. The Additional field is populated. It is related to the case. And it logs the activity too.

Below is a list of parameters definitions:

template_id = id of email template you want to pre-populate
email_type=visualforce (if the template that you’re using is a VF email template)
new_template=1 = required if you’re using a VF email template that contains an attachment
p2_lkid = id of the record for the To address (a Contact, Lead, or User Id)
rttype = the id prefix for the type of the To address (e.g., if p2_lkid refers to a Contact, use rttype=003)
p3_lkid = id of the record for the Related To (i.e., What) record (e.g., an Account or Opportunity)
p4 = CC address
p5 = BCC address
p6 = Email subject
p7 = Email body
p24 = Additional To
p26 = From address
doc_id = the id of a Document or QuoteDocument to become an email attachment
retURL = URL to return to after the email is sent
cancelURL = URL to return to if the user clicks Cancel

Leave a comment