HI, i would like to create an automation that notifies when a new contact is possibly duplicated, comparing the email or phone from the new contact with the email or phone of the existing contacts and in case that exists a coincidence trigger a notification that the contatc that was just created is possibly duplicated
thanks!
Hi @Danicamvi5!
This can be a bit tricky but it’s definitely doable.
You can run a search action by email address to locate any duplicates. If you wanted to use the phone number instead, you’ll want to ensure all of your phone numbers are formatted exactly the same way. You can do this by running a formatting automation anytime an item is created in your app. Here is a code snippet I use to get numbers in (xxx) xxx-xxxx format:
var result = "";
var cleaned = (contact_field_phone_phone).replace(/\D/g, '');
cleaned = cleaned.charAt(0) == 1 ? cleaned.split(1)[1] : cleaned;
console.log(cleaned);
var match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
if (match) {
result = '(' + match[1] + ') ' + match[2] + '-' + match[3];
}
console.log(result);
var_phone_cleaned = result;
Once all phone numbers are formatted the same, then you can set up your duplicate checking flow to search on email address in addition to phone numbers.
Another tip, you’ll want to make sure your search action doesn’t find the triggering item (otherwise it would always find itself in your search). You can do that by setting the search to skip items that have the same item ID as the triggering item. It would look something like this:
Hopefully that can help! I can provide more specifics if needed.
6 Likes
How could I do it with the e-mail. I am not understanding very well what is the value in App record ID . Also by applying the code above i got this error message.
[400] validation: Filtering value is empty, make sure to provide a search value for all specified filters
It would be the same search action as shown in the screenshot, but instead of searching a phone number, you would search the email address field for your triggering record’s email address.
The App Record ID is Tape’s ID for each individual record. We use this in the search because without it, searching for a matching value will always locate the triggering record in the search. So, this tells the search step to ignore the record that’s triggering the flow.
If you can provide a few screenshots showing your flow then that might help us identify what’s going wrong.