While creating fields in any object you have the option of specifying the field as UNIQUE. This means that the field can only have unique values and is meant for eradicating duplicates.
But, mostly we need to have a combination of fields to determine a unique record. For ex, say that “Account Name” and “Billing Country” together determine a unique record. In such a case, you cannot make the “Account Name” as well as the “Billing Country” fields unique, since the combination of these two fields is only unique and not they both separately.
In situations like this, we mostly write a trigger. But, there is a more easy and out-of-the-box functionality available.
STEP 1: Create a new field in the account object called “AccNameBillingAdd” with the field type “Text”.
Make the field invisible to all profiles, of course the “System Administrator” would still have access to this field.
Do not add the field to any page layout.
STEP 2: Create a new Workflow rule on the “Account” object.
Create a “Field Update” for the workflow.
Do not forget to “Activate” the workflow.
STEP 3: See it in action, by creating two account’s with the same Name and Billing Country. While you try to save the second one, you will be shown an error message as below.
The error message is meaningless; do let me know if you have any suggestions.
“Explore – Techila Global Services, A Salesforce development company”