When a case created via Email-To-Case or Manually or when editing a Case, you might notice that you cannot access the AccountId in certain scenarios. Below we will go through a reproducible scenario and state the result.
trigger DebugCaseValues on Case (before insert, before update) {
for(Case c : Trigger.new)
System.debug('##### Case values: ' + c);
}
In the results, we can see that, for the Standard User, the AccountId is returns null in the Before Insert event when both Account and Contact are being assigned on the Case creation.
000387008

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.