Salesforce and Application Integration > Techniques > Checking for Duplicate Leads and Contacts
  

Checking for Duplicate Leads and Contacts

When entering a new lead or contact, you may want to check if it already exists. This topic demonstrates how to do this.
Here's what the completed guide looks like:
Check for Duplicates guide

Step 1: Set Guide Properties

This is really the crucial step. The guide must access data of some kind but the fields do not exist into which they can be entered as the guide will not be associated with an object. You can create the fields that Guide Designer will use to store this data by using the Guide Fields tab.
Guide Properties Guide Fields tab
Now that these fields exist, you can insert them in steps and the data that users enter can be used in searches.
The three fields created are:
Notice that the type of the first two is Text and the last is Object ID. Guide Designer searches for the name. If it is found, it also has the object ID associated with the name. This means that the person was found.
You will want also want to set to create a guide that is not directly associated with a Salesforce object. Also, you should place it on the Home page so that users will have a place from which they can launch it.

Step 2: Create a Screen Step for entering a name

Create a Screen Step into which a user can type a first and last name.
Inserting a Read Only field
Insert two updateable fields using the picklist. Notice that the three fields defined in the Guide Fields tab are there.

Step 3: Create a screen step for selecting a lead

In this step, you will need to set an inserted field's properties, as is shown in the next figure.
Setting field properties
The step will display a list whose contents come from an object query. This query uses the contents of the fields that were filled in within the previous step as part of the query's Where clause.
Don't be concerned about the information within the curly braces "{}". If you use the Add Condition dialog, Guide Designer adds them for you.
Setting a condition
After Guide Designer executes this step, it will show a four-column table. It will have the three columns entered within the Display Columns area and a fourth column containing radio buttons. If the lead is within the table, the user will select one of them.

Step 4: Was something returned?

After the previous step executes, it sets the value of the Search Lead List field. You can now add a decision step that tests if this field was "set" or "unset", indicating if something was or was not found.
Deciding if something was returned

Step 5: Next Steps

All that is left is create the steps that follow the decision step. In this example, one branch is followed when the lead does not exist and the other for when it does.
Creating the step for entering information