We have an inbound Email handler that currently just creates a Task. I'd like to update it to create an EmailMessage object instead. However I've noticed that when viewing the Apex-inserted object in Salesforce it appears with a heading of "Outbound Email Message".

Is there a way to signal to Salesforce, when creating an EmailMessage, that it was in fact inbound?

1 Answer 1


You need to set the Incomng field to true. See the documentation:



Create, Defaulted on create, Filter

Indicates whether the email was received (true) or sent (false).

  • Thank you! I would not have noticed that easily. On a related note, it always produces an Email with status "Draft", and the related Activity it generates is always "In Progress". Is there a way to have the Email end up with a different status than Draft and/or have it generate a "Completed" Activity without doing a second DML update after?
    – Charles T
    Apr 26, 2017 at 14:23
  • @CharlesT You should be able to set the Status field, too.
    – sfdcfox
    Apr 26, 2017 at 14:46
  • Ahh OK I did not realize I had to use numbers in the picklist. blog.crmscience.com/2013/02/emailmessage-status-values.html
    – Charles T
    Apr 26, 2017 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .