DEV Community

Cover image for Make Salesforce Emailing Effortless: Customize SendEmail Action in 3 Simple Steps
Oleksandra Todorenko
Oleksandra Todorenko

Posted on

Make Salesforce Emailing Effortless: Customize SendEmail Action in 3 Simple Steps

If you want to streamline your email communication with customers and colleagues in Salesforce, you may consider overriding the standard SendEmail action with predefining certain fields, such as To, CC, BCC, subject, body, email template and others. Especially, it would be a great time saver if Salesforce users are still doing it by themselves every time when Email should be sent.

By doing this, we can save time, increase productivity, ensure accuracy, maintain compliance, and personalize communication. A great benefit is this can be done without any coding, making it a simple, quick and accessible solution for Salesforce Admins who want to optimize their workflow.

When and why you should think about overriding

There are several main cases where overriding the standard SendEmail action with a custom action that predefines certain fields can be useful for Salesforce Admins:

Consistency and accuracy: By predefining fields like the recipient, subject, and body, you can ensure that all emails sent from Salesforce are consistent and accurate. This can help to maintain a professional image and avoid errors or misunderstandings.

Efficiency and productivity: Predefining fields in a custom SendEmail action can save time and increase productivity, as users don't have to manually enter all the details each time they send an email. This can be particularly useful for sales teams or customer service representatives who need to send multiple emails per day.

Compliance and governance: In some industries or organizations, there may be strict regulations or policies around email communication. By predefining fields in a custom SendEmail action, you can ensure that all emails sent from Salesforce comply with these regulations and policies.

Customization and personalization: By predefining fields like the email template or the CC recipients, you can customize and personalize your emails to better suit your audience. This can help to build stronger relationships with customers and colleagues.

A step-by-step guide to Override Standard SendEmail Action

Unfortunately, the standard Salesforce SendEmail action is not editable, which means that we cannot set field values exactly as we want in the standard action.
However, we can create a custom action that will replace the standard one and allow us to predefine certain fields. Here are 3 simple steps to achieve it:

Step 1: Create a Custom Action

Go to the Object Manager and select the object for which you want to create the custom SendEmail action. In this example, we'll use the Opportunity object.

Click on the "Buttons, Links, and Actions" tab and then click "New Action". Select "Send Email" as the action type and enter a label and name for your custom action.

created custom SendEmail

Step 2: Set predefined fields

Under Action Details, you can define the predefined fields for your custom SendEmail action.

Example of fields that I created you may see here:

Predefined fields example

Here is a list of fields that can be predefined, with their API names and short description:

Fields to predefine

  • BCC (BccAddress): email addresses that will be BCC'd on the email (hidden from other recipients)
  • BCC Recipients (BccIds): the User or Lead/Contact who will be BCC'd on the email
  • CC (CcAddress): the email address that will be CC'd on the email
  • CC Recipients (CcIds): the User or Lead/Contact who will be CC'd on the email
  • Email Template (EmailTemplate): the email template that will be used for the email content
  • External Id (ExternalId): an optional external ID field that can be used for integration purposes
  • From (ValidatedFromAddress): the email address that the email will appear to be sent from. This must be a verified email address in your organisation.
  • Html Body (HtmlBody): the HTML version of the email content
  • In Reply To (InReplyTo): the Message-ID of the email being replied to. This is used to thread email conversations.
  • Message Id (MessageId): the Message-ID of the email. This is used to thread email conversations.
  • Primary Who (Who): the primary Lead/Contact/User that the email is being sent to
  • References (References): the Message-ID of the email being replied to and other Message-IDs in the conversation. This is used to thread email conversations.
  • Related To (RelatedTo): the record that the email is related to. This is typically used when sending emails related to a specific record in Salesforce.
  • Subject (Subject): the subject line of the email
  • Text Body (TextBody): the plain text version of the email content
  • To (ToAddress): the email address that the email will be sent to
  • To Recipients (ToIds): the User or Lead/Contact who will receive the email

Step 3: Replace Quick Action on the layout

Once you have defined your CustomEmail action, you need to add it to the Object’s page layout. Go to the page layout editor for the desired object, in my case it’s Opportunity, select the "Mobile & Lightning Actions" section, and drag your custom SendEmail action to the section.

Custom SendEmail on layout
You need also to remove the standard SendEmail action from the section.

Standard SendEmail on layout

It is necessary as then exactly custom SendEmail action will be launched when clicking on the Email activity button. All the others SendEmail actions will be accessible by clicking the arrow from the right side.

arrow down

Result

And that’s it! The predefined fields you defined in Step 2 should now be populated with the values you specified, allowing you to quickly and easily send an email without having to manually enter all the details.

Let's compare standard and custom SendEmail actions:
Standard:

Standard SendEmail

Custom:

Custom SendEmail

Standard Salesforce SendEmail action cannot be customized, but don't let that limit your ability to streamline your email communication processes. By creating a custom Send Email action and predefining fields, you can save your users time and effort. This is especially useful if you frequently send emails to a specific group of people, or if you want to ensure that certain fields are always filled out correctly.

Whether you're a Salesforce admin or a developer, this customization can be a great way to enhance your organization's productivity and make your users' lives easier.

If you have any questions or comments, please don't hesitate to reach out here or in LinkedIn – I'm always happy to connect with fellow Salesforce enthusiasts!

Top comments (0)