This function is for clients who do not want any data overwritten by automated duplicate checking functionality because they may have two separate clients that share a phone number or email address. This function returns either "Unique Phone & Email" or "Potential Duplicate" in a drop down field and is paired with an automated email notification. If, upon checking, the client has verified that the two contacts are different, but share an email or phone, they can select the third option in the drop down menu "Verified Not a Dupe"
ContactDetails = zoho.crm.getRecordById("Contacts", ContactId);
form_email = ContactDetails.get("Email");
form_phone = ContactDetails.get("Phone");
contactInfo = zoho.crm.searchRecords("Contacts","(Email:equals:" + form_email + ")",1,200);
contactPhone = zoho.crm.searchRecords("Contacts","(Phone:equals:" + form_phone + ")",1,200);
info contactInfo;
info contactPhone;
info contactInfo.size();
info contactPhone.size();
if(contactInfo.size() > 1)
{
mp = Map();
mp.put("Contact_Check", "Potential Duplicate");
mp.put("Owner", contactInfo.get(1).get("Owner").get("id"));
update = zoho.crm.updateRecord("Contacts",ContactId,mp);
info update;
}
else if(contactPhone.size() > 1)
{
mp = Map();
mp.put("Contact_Check", "Potential Duplicate");
mp.put("Owner", contactPhone.get(1).get("Owner").get("id"));
update = zoho.crm.updateRecord("Contacts",ContactId,mp);
info update;
}
else
{
mp = Map();
mp.put("Contact_Check", "Unique Email & Phone");
update = zoho.crm.updateRecord("Contacts",ContactId,mp);
info update;
}