Could anyone tell what is the order of execution, when there is a case created from the email-to-case configuration?
I am in the process of differentiating a case to assign a status to it. AFAI tested the sourceId is populated when the case is created via Email-To-Case.
What's the order of execution on sourceId assignment in a Case?
In the before insert trigger the case sourceId is always null. What's the order of execution as I couldn't find it anywhere on the document?
I assume,
When sending an email to the Email Service Address,
- Create an Email Message.
- Create a Case.
- Update the ParentCaseId on Email Message
- Update the SourceId on Case.
I was trying to do the below check in the Case before insert trigger, but it didn't work as expected,
if (newCase.sourceId != null) {
newCase.Status = 'In Progress';
}
Any idea on this?