UNIQUE FIELD COMBINATION IN SALESFORCE | Techila
2000
single,single-post,postid-2000,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

UNIQUE FIELD COMBINATION IN SALESFORCE

UNIQUE FIELD COMBINATION IN SALESFORCE

UNIQUE FIELD COMBINATION IN SALESFORCE

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”.

Create a new field in the account object

Make the field invisible to all profiles, of course the “System Administrator” would still have access to this field.

field invisible to all profiles

Do not add the field to any page layout.

Do not add the field to any page layout

STEP 2:  Create a new Workflow rule on the “Account” object.

Create a new Workflow rule on the “Account” object

Create a “Field Update” for the workflow.

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.

Error message is meaningless

The error message is meaningless; do let me know if you have any suggestions.

Courtesy:  http://www.forcetree.com/2010/07/unique-field-combination-in-salesforce.html

“Explore – Techila Global Services, A Salesforce development company”

Author: techila

No Comments

Post A Comment