Find your content:

Search form

You are here

Account name not populating when Email2Case is used


When users choose to create a case from an email it does not auto populate the Account name in the Case form. It works fine if you view a customer and create a case from the detail view page but not from an email (the customer does exist with the same email address.)

Also when I view a customers details it's not showing the emails in the history, so it's obviously not linking the email with the account.


Here is a code sample:

List<String> subjectParts = email.subject.split('_') Select account where name = subjectParts.get(0); List<String> servers = subjectParts.get(1).split('-'); 
Select a.Id, (Select Id, Subject From Cases where IsClosed = false AND Subject = :servers.get(0)) From Account a Create case. case.Subject = servers.get(0);

Attribution to: shivaram

Possible Suggestion/Solution #1

Most likely there is more than one contact using the same email addresss. Therefore, the account/contact are not automatically populated.

In regards to the second issue, are you sure you have added the "email" related list to the page layout.?

Attribution to: PepeFloyd

Possible Suggestion/Solution #2

I can think of a few reasons why the Contact is not being attached:

  1. The email did not match any Contacts
  2. The email matched more than one Contact
  3. The email is not in the standard email field (Salesforce will not match on custom fields.)


The Account field is generally populated based on the Case's Contact; when the Contact is populated Salesforce automatically pulls in the Contact's Account. If you aren't setting the Contact lookup I suspect that is why the Account is blank.

Attribution to: Mike Chale
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content