How to delete spam from your Salesforce instance

If your Salesofrce instance is connected to your website (for users to sign up for your newsletter, make donations, or register for events) chances are you've had to deal with spammers at some point. There are a handful of ways that spammers can beat CAPTCHA, despite it's reputation as the gold standard for defense against spam (at least at the non-programmer happy hours I frequent).

To remain one step ahead of the spammers, newer and tougher to crack technologies are available, such as setting up a honeypot or using Mollom's service. These alternate solutions of course take time and money to implement, something that everyone is short on these days. I could get into the pros and cons of new spam solutions, but that's not exactly what this blog post is about.

We also think fighting spam should be a two-pronged approach: preventing new spam from getting into Salesforce, but also getting rid of spam that's already there. Because even if you're ready to implement the lastest spam-blocking technology, you've probably already got some spam in your Salesforce database. That's what I'm going to help you tackle today.

I'm going to share a quick and simple workaround for deleting existing spam accounts in Salesforce. This workaround targets spam where the first name and last name of a contact are exactly the same. You know the ones I'm talking about. Sometimes it's as simple as Thomas Thomas, but I've seen some great ones – such as Rarfrhith Rarfrhith, Ybarrz Ybarrz, IyattMottx IyattMottx…you get my drift.

1. Create a new formula field on your Contact record. Name it Same firstname lasname, and select Text.

2. Enter this formula: if(FirstName = LastName,"Yes","No"). Do not add it to the page layout.

3. Set up a report of all contacts, with the filter Same firstname lastname equals Yes. Click run report.

4. This is your report of all contacts where the first name and last name have the same values.

5. Use a mass deletion tool (we love Demand Tools) to mass delete the contacts, or

6. Use built-in Salesforce functionality to mass delete contacts: Navigate to the Contacts home tab.

7. Scroll down and click on Mass Delete Contacts.

8. For search criteria, select your newly created field "Same firstname lastname" equals Yes. Click Search.

9. Select all results. Click Delete.

Larissa Neale is a Salesforce implementation consultant who has long detested spammers, telemarketers, and door-to-door solicitors. Email her if your organization needs help with Salesforce maintenance.