function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
B2AB2A 

Combination of 3 fields must be unique in Salesforce

Hi, I'm not sure if Validation rules can do this, perhaps there's a nother way :

 

 

The combination of 3 fields on an Account record must be unique (so no other account record can have the same combination of values in the 3 fields). 2 of these fields are Text fields while one is a picklist.

 

Has anyone been able to do something such as this.

 

Any help will be great!

 

 

 

 

 

CRM JediCRM Jedi

There might be a better way to do this but here is mine:

 

1. Create 1 text field in your object, select the "No Duplicate Allowed" option

2. Create a Workflow Rule to do a Field Update on that field everytime a record is created or updated. The value to udpate should be the combination of your three fields. ie.

 

Field_1__c & Field_2__c & TEXT(Picklist_Field__c)

 

This should show an error when the user tries to save a record with the same combination as another record.

 

The drawback of this method is that the error shown is not meaningful enough for the users to understand what has gone wrong and to my knowledge, SFDC doesn't let you customize the error message. 

 

B2AB2A

Thanks.  This is a very nice workaround.  Saves a lot of time!  I was worried that the last picklist formula (TEXT(Picklistfield__c) wouldn't work but it did which was great!!