+ Start a Discussion
vino2vijayvino2vijay 

How to handle duplicate case based on Subject name (Email to Case)

Hi Team,
We are facing some issues when it will create CASE record in salesforce. We have implemented Email to Case standard features is our production org. when we are sending email to particular mail box with copy of cc someone then as per designed case is created successfully in to Salesforce. But before someone reply from Salesforce, some body who's copied in that email, they started sending email using same email thread from outlook. So its getting generated new case whenever Salesforce receive email. Since no body reply back from Salesforce, so there is no ref number also.
Please find the below example for your understanding
Current Issues :
1. XYZ customer sending email with CC people and subject name as "ABC" to salesforce and case got Created Salesforce with Subject name as "ABC".
2. Immediately CC people replying to email message using same email thread in outlook.
3. Salesforce will receive one more email with same subject name as "ABC" and new case will be created.

Expected Solution:
1. Only one case should be created under same subject name as "ABC". Even though if Salesforce receive multiple email from outlook with same subject.
2. We need to capture the Email information from cc people. (Technically, we need to capture the Email message records not case record)
3. All Email Message should comes under same Case.

As part of the above scenario, I have wriiten some logic in before insert trigger on Email message object and i am successfully able to idenity the Same subject and delete the duplicate case.
Now my question, is there any way to distinguish the case other than subject. Also I have checked on Email Message object, it storing Email Headers. Is there any unique way to identfier using Email Header ??

Any help, really appreciate
thanks,
 
MicheTMicheT
Did you ever find a solution for this?
VENKATA BABIVENKATA BABI
Hi vino2vijay

You got any solution for this, we also stuck at same situation.

I have wriiten some logic in before insert trigger on Email message object and i am successfully able to idenity the Same subject up to here I too did, moving forward I am not getting any idea. Any favour from your side would help me a lot.

Thanks in Advance.
Harisa HashimuddinHarisa Hashimuddin
Hi All,

What I would propose is an auto-response email from the trigger on the Email Message. You will need to 'cook up' the corresponding original Case's 'ThreadId' -- please have a look at this link (http://theblogreaders.com/generating-salesforce-case-thread-id-using-apex-class/). Then, including this 'ThreadId' in the auto-response can solve your issue, because, 'ThreadId' is unique to each Case. This way, when the cc'd people reply in the same thread, the email body will have the original Case's thread id, and eventually all the emails in the thread will get routed to the original Case.

I know it's a bit confusing. Please get back to me if you have any questions or if my suggestion was helpful for you.

Best,
Ido Greenbaum 10Ido Greenbaum 10
Hi Vino,
Please refer to the followin article, which will assist in bulding an Email Service to handle duplicate cases, by aggregating emails under the same Case Subject.