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 

Validation possible? combination of 3 fields on an Account record must be unique

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!

 

forcedotcomforcedotcom

You can't do this with a validation rule - what I'd do is create a formula text field on the account to concatenate the 3 values into a single field, and then write a trigger to query the existing data. You could then display an error message should it find a match.

 

Regards,

forcedotcom

B2AB2A

Thanks for the idea.  I actually received a cool workaround from CRM Jedi on this user group.  He said to create a text field that is Unique (no duplicates).  Then create a workflow rule that does a field update.  This workflow rule fires when a new record creates and the field updates with a formula which appends the three field values. 

 

(Formula:  Field1__c & Field2__c & TEXT(PicklistField__c))

I realized I had 4 fields rather than 3 but Text fields hold upto 255 chars which was sufficient enough.

 

 

 

Since the text field has to be unique, it cannot have the same value as another record.  This does what I want, the only draw back is I cannot customize the error message since it is system generated but that is fine as it does the key function which is to check whether field combinations are unique!

 

 

daniel.duartedaniel.duarte

I did the same thing here, I needed an unique field combination and solved it the same way, using an Unique Text Field and a Workflow Rule. Now I'm searching for a way to customize the error message. I really need to display a more intuitive error message for the user, and if I can´t customize this message I will have to find another way of doing it. Does anyone know a way of doing it?