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
SwamplanderSwamplander 

Finding dupe emails...

My company has been using SF for a year+ now... but only stand alone. I'm now integreating lead generation and auto management (for those who purchase stuff and converting to opportunities) into our website when people create accounts. That's the easy part...

 

Once that's done, I'm want to import all our existing accounts in our site into SF as leads. For us, the uniqueness of a person is their email address. I suspect many of the people who've registered on our site are in our SF account, so I don't want to do a big import as it doesn't appear SF treats emails on records as unique. One bruteforce option is to walk through all 10,000+ user accounts on our site to see if they are already in SF and if not, create the lead. Not horrible as I can build a script that can do this overnight, but I'd prefer to avoid it...

 

I was hoping there was some way to make this easier and quicker... any ideas?

Best Answer chosen by Admin (Salesforce Developers) 
shillyershillyer

You add this as a Trigger for the Lead object (Setup > Customize > Leads > Triggers). Once you create this trigger and make it active, it will be respected when creating leads through the Web UI or the Web Services API.

 

Hope that helps,

Sati

All Answers

shillyershillyer

Take a look at this trigger example. It prevents new leads from being created if the email address already exists. You can then run mass imports against this and the leads without duplicate emails will be created.

 

There's also a test method here.

 

Hope that helps,

Sati

SwamplanderSwamplander
Thanks! This looks like exactly what I need... but i'm a but confused as to where/how I do this. Looking trough the Web service API reference I see a section on this, but just not sure where/how I add it...
Message Edited by Swamplander on 02-13-2009 04:32 AM
shillyershillyer

You add this as a Trigger for the Lead object (Setup > Customize > Leads > Triggers). Once you create this trigger and make it active, it will be respected when creating leads through the Web UI or the Web Services API.

 

Hope that helps,

Sati

This was selected as the best answer
aalbertaalbert
The Force.com IDE is another great developer resource for coding and deploying Apex triggers, classes, visualforce pages, migrating changes from one org to another, ect.
SwamplanderSwamplander
Perfect... that's exactly what I needed. Interesting it didn't show up in searches :(