Open Send Email form on Custom Button click in Salesforce

Author - Anjana Devi
12.03.2018
|
0 Comments
|

In Salesforce, how to open standard ‘send email page’ by clicking a custom button located on Detail Page of a custom/standard Object?

Steps to open an Email Page from Custom Button:
1. Add a custom button first. Go to Custom Object settings, Then Click New button and link.
2. Create new button.

Example: I have created a new button named as Task Updates in Detail Page of the custom object.

Below is the screenshot of form to create Task Updates button:

Following URL is used to open ‘send email’ page to send the email to the recipients:

location.replace('_ui/core/email/author/EmailAuthor?p3_lkid={!Acquisition_Task__c.Id}&retURL=/{!Acquisition_Task__c.Id}&p2_lkid={!Acquisition_Task__c.Responsible_Party_1Id__c}&p24=test1@mailinator.com,test2@mailinator.com,test3@mailinator.com&p4=test5@mailinator.com&p5=test6@mailinator.com&template_id=00X18000000Qeqv');

Parameters of this URL are:

p3_lkid: It is used to store the id of the object. It fills ‘related To’ field in send email page.
retURL: This is the return URL if cancel is pressed. We can store URL to the id of the object in this parameter.
p2_lkid: It is used to store the id of the recipient to whom we want to send the email. It fills the ‘To’ field in send email page.
p4: It fills the ‘CC’ field in send email page.
p5: It fills the ‘BCC’ field in send email page.
p6: It fills the ‘subject’ field in send email page.
EmailBody – It stores the body of the email.
p24: It is used to store more recipients. It fills ‘Additional To’ field in send email page.
template_id: It will store the id of an email Template.

Note: p3_lkid and retURL are required fields while all others are optional fields. Also, we can add multiple email addresses in the p24 parameter separated by a comma.

Go to Detail Page of the custom object. Then click on Task Updates button as shown in below screenshot:

After clicking on the Task Updates custom button, the send email page will open.
screenshot of the send email page is here:

In send email page, we can select email template by clicking on Email Template button. At last, click on the Send button to send the email to all recipients as shown in above screenshot.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

Send your message