Its similar to this issue: Email to case:Multiple cases for same email replies

Scenario 1 - When some users sends an email to the email to case, it create a case as expected. When I reply to that loop using Salesforce, I end up inserting the case thread ID on the body. After that every time that a user replies on that thread, all their email goes to the correct case number.

However if customers are sending email to each other, with the email to case on the loop, cases are being created, until one salesforce user finally reply from a case - which adds the case thread id on the body and than finally scenario 1 happens, however lots of cases were already created.

So, how to avoid that?

I've tried to use the EmailMessage ThreadIdentifier field, which contains the ID of the loop thread. On the before trigger on EmailMessage object, I would check if there is any other EmailMessage with the same ThreadIdentifier and if there is, I would point the new email to the same existing case and delete the recently created case (which was just created by the new email). However the ThreadIdentifier is null on the before trigger... So I'm still looking for a workaround for that.

Do anybody suggest anything? Thanks!

1 Answer 1


Using Message headers is going to be the way by default in the future. The linked Knowledge Article explains how to use the new behavior.

Starting with the Winter ‘21 release, all new orgs default to the new threading behavior and Email-to-Case no longer supports string-based threading. The Release Update, Disable Ref ID and Transition to New Email Threading Behavior, lets admins of existing orgs opt-in to the new threading behavior by turning it on or off until Salesforce enforces this update in the Summer ’22 release.

You must log in to answer this question.

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