Sunday, March 29, 2020

Salesforce: EmailMessage object

When Enhanced Email is enabled, Salesforce will create EmailMessage object. Emails sent from Salesforce are saved as Email Message records and Task records. There is a link from the Email Message record to a Task record, which is ActivityId field.

If you use Outlook panel (and not enable EAC), you can "Log Email" manually to Salesforce for email received and sent out. Both emails received and sent will be stored both as EmailMessage (prefix 02s) record and Task record (prefix 00T).

How to differentiate email send from Salesforce and manually logged from an email client?
You will not find any difference on the Task object, both Type and TaskSubType will populate with "Email". But there are some differences in Email Message object. Check out this query:
SELECT Id, ActivityId, FromAddress, ToAddress, FromName, IsClientManaged, MessageIdentifier, Subject, TextBody FROM EmailMessage

Row 1,4,5 - email manual log from Outlook
Row 2,3 - email sent from Salesforce

As you can see, IsClientManaged and MessageIdentifier are different.

Note: using My Email to Salesforce service (BCC) will not create Email Message records, but only Task.

Email in Lightning activity component
All email logged to Contact or Lead will be shown in the Lightning under activity component.

For manually logged email to Salesforce, click the email will open EmailMessage record, you will be able to Reply All, Reply, or Forward the email from that panel. Hover mouse over the email will show the URL where it will be landed, example:

For email from BCC email services, click the email will open Task record, there is no option to reply, reply all or forward as the record is a task. Hover mouse over the email will show the URL where it will be landed, example:

For EAC email, click the email will open the email in that panel, you also able to Reply All, Reply, or Forward the email from that panel. The system also shows if the email is shared with everyone or a group or not shared. Hover mouse over the email will not show any URL, click "View full email" will open the full email as email stream.



  1. Hello,
    In the same way, do you know how to use in FLows the EAC Events ? I try to "Get Record" but I have an issue.

    1. EAC data is not stored in SFDC, so I doubt you can get it from flow.

  2. Is it possible to use a flow to create a task and copy over the relevant informaiton into a standard task when an email message is created?

    1. I see Email Message object is available on flow, so i think should be possible

  3. I'm trying to investigate how to delete the tasks that gets created when an email is send from Salesforce. Any idea's how i could accomplish this?

    1. you may use Flow for this, checkout this video

  4. How to share emails (incoming) to any specific queue.

    1. checkout this one

      If IsPrivateDraft is set to true, then only the CreatedById user can view, update, and send this email draft. If IsPrivateDraft is set to false, then any user with permissions to work on the case can see these drafts. Once the email is sent (Email Status = Draft), then this field is updated to be false. Public drafts are loaded and visible in Salesforce Classic while Private Drafts are only used in Lightning Experience.


Page-level ad