I need to assign the case (created through email-to-case) to the account owner if certain condition satisfies. In the before insert of the trigger event, I assign the newly created cases' owner id , however owner doesn't get updated for the case. I checked the debug log and see in the before insert event account is null.
I put the same code in before update and it's working fine , obviously account is not null in before update when case is created through email to case. I checked the debug log and couldn't find why account will be null in before insert, but not in before update. Neither, I can find any automated process which will populate account on the case. I set the field tracking for account on case and see , 1) Case is created first 2) Account on case is updated if the case is created from the email and the contact->account exists with that email id.
I wanted to know, if this is expected behaviour? Or am I missing some automated process in my org which may be updating account on the case? If this is expected, is there any documentation around it?