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
Ian GendreauIan Gendreau 

Auto assign lead if email exists at Contact level

Saw a similar issue, but not quite the same, so here goes.  We have a bunch of custom web forms feeding leads into SF.  We worked with a developer to make these.  Not quite straightforward as they not only include standard "Name", "Email" and "Message" fields, but also take a WooCommerce shopping cart and dump the contents into a custom SF field.

The developer we worked with went as far as getting those forms into SF as leads.  But there is no checking to see if a contact with the same email address already exists. Here's what I'd like to be able to do:
  1. A lead comes into SF from our website and is assigned by default to our Sales Manager (this happens now)
  2. SF checks to see if that email address already exists as a Contact's email address
  3. If it finds a match, it changes the Lead Owner to match the Contact owner and sends an email to that owner
We can take care of the duplicates when converting Lead to Opportunity.  Is there a way to do this? 
Michał Zadrużyński 2Michał Zadrużyński 2
Have you tried to do this with before insert trigger on lead? But you need albo remebre that contat e-mail is not unique so you can have already few contacts with same email.