Steps to Reproduce :
1.Set up an Email-to-Case flow in your Salesforce organization.
2.Ensure a Contact record is associated with the email address for the case.
3.Create a before insert trigger on the Case object. For example:
trigger DebugCaseValues on Case (before insert) {\
for (Case c : Trigger.new) {
System.debug('##### Case values: ' + c);
}
}
4.Create a Case by sending an email to your Email-to-Case address.
5.Check the debug logs for trigger execution.
6.Observed Result
The debug logs show that the AccountId field is null in the before insert context.
##### Case values: Case:{Id=null, ..., ContactId=003..., AccountId=null, ...}
This behavior is working as designed.
Salesforce performs internal post-processing to properly associate the Case with the Account from the related Contact. This process occurs after the record has been committed to the database (i.e., after insert). The AccountId isn't available during the before insert trigger because the platform hasn't yet finalized the relationship between the Case, Contact, and Account.
005132457

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.