Skip to main content
With the new update of email-to-case threading behavior, Thread-Id field is being deprecated: https://releasenotes.docs.salesforce.com/en-us/winter21/release-notes/rn_email_to_case.htm 

I have an apex class that sends out an auto-response to contacts in a case based on a integration to a customer portal.

I added the thread-id before from the case before but now when this doesn't work I need to set header info so when a contact responds to the auto-response the response is added to the case, and doesn't create a new case according to this new email-to-case behavior.

I have tried using the setReferences() on Messaging.SingleEmailMessage to set a reference to the case, but I can't find proper documentation of how to set the reference, I just need a reference to the case so the response gets inserted correctly.
8 respostas
  1. 13 de mar. de 2022, 07:25

    @Andegosu, Thanks for the solution. Its working fine in my usecase where I already have an email message associated to the case and I am sending the email through apex for the subsequent emaill. Now user can reply to the email notification which is successfully adding back to the parent case instead of new case. 

    Your solution to add the email headers from earlier messages is working as expected. 

     
0/9000