2

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,

  1. Create an Email Message.
  2. Create a Case.
  3. Update the ParentCaseId on Email Message
  4. 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?

3
  • 2
    the Case is created before the EmalMessage
    – cropredy
    Jan 13 at 20:12
  • So, it makes sense that the sourceId is null. Jan 13 at 21:53
  • i've not specifically tracked when sourceId is set -- writing debug statements in a Case trigger and turning debug on for the E2C user will let you know when it is set
    – cropredy
    Jan 13 at 22:28

1 Answer 1

1

The order is follows,

The case is created.
The email message is created with the parentId.
The case sourceId will be populated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .