function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hanna BergsmaHanna Bergsma 

Help with flow to identify duplicate cases from client sending same email to multiple E2C

We have multiple email-to-case addresses in our org. Client's frequently email multiple of them to 'make sure their email gets read'. Okay. Anyways, cutting it down to only one email-to-case address isn't an option for us, and clients will continue to email multiple no matter if we ask politely or threaten their loved ones. 

When this happens, we get one case for every address the email is sent to. I tried creating a flow that, after creating a case, looks for other  'Gets' cases with matching subject, and supplied email, and created time/date. Then I'd like to update the subject line to 'Duplicate Case'- [Subject]

Below is my flow and Get Records detail. When testing it puts 'Duplicate Case' on every single E2C coming in. What did I do wrong? I tried adding in "id does not equal Record.id" and then it didnt add the text to ANY of the emails, even the duplicated.
User-added imageUser-added image


 
Vishwajeet kumarVishwajeet kumar
Hello,
Seems like all emails are coming at same time( implied due to use of Created Date in query), you might need to implement something which is scheduled to go over all case records by datetime, pick one and mark all other duplicates with matching data. CaseNumber can be used to idenitfy among them which one got created first, if you need some order in marking duplicate.

Thanks
Hanna BergsmaHanna Bergsma
Hello, 

The language is being added to ALL cases, not just the ones with duplicates. If one case comes in with a unique subject and time, it is still getting marked as a duplicate. 
Vishwajeet kumarVishwajeet kumar
Yes, off course because the way data comes all at once and flow is querying for all Case records with same information. You have to do something scheduled when you get all the data(, here record triggered flow is getting triggered for every case).

Try Scheduled flow or Scheduled apex job : Get all the data which came in a certain duration sorted by CaseNumber or by any other field to help pick a non-duplicate record, loop through to mark all others matching duplicate.

Thanks
Robert Michael 6Robert Michael 6
Hi Hanna, out of curiosity what did you end up going with? 
I am facing the very same scenario and not entirely sure which way to go. Thank you