Wednesday, 23 November 2011

Creating a unique record on salesforce, duplicate record preventer.

If you were to create a single record in an object on Salesforce, then you can probably use the unique identifier during the creation of the custom field.

But when you have to base uniqueness on more than one field on a record, there is an easy way around this.
For example, you have to base uniqueness on two different custom fields first_name__c and last_name__c

Follow these steps:
1. Try to create a Text field on the object, make it unique.

2. Try to create a work flow every time a record is created or edited in the object

3. Add a field update in your workflow action, 

4. In the field update action you can select the Text field you created and use a formula to concat both the first name and last name. In the formula editor, put in
First_Name__c +Last_Name__c

5. Activate the workflow.

6. Now the system should prevent you from creating a duplicate record based on two fields.