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
GoldwinGoldwin 

Prevent duplicate using validation rule

Hi,

 

I need to restrict the use from entering duplicate records, for this need to validate two fields.

 

For example:

 

Object: Categories

 

Fields: category Name - Text

             Type - Picklist

 

Here each type should have unique values only, but the category values can repeat in another type.

 

validation Rule:


F(AND(Name = VLOOKUP( $ObjectType.Category__c.Fields.Name , $ObjectType.Category__c.Fields.Name, Name ), NOT(Id=VLOOKUP
($ObjectType.Category__c.Fields.Id , $ObjectType.Category__c.Fields.Name, Name ))) && TEXT(Type__c ) = TEXT( Type__c ), true, false )

 

But this will not work properly. Any Idea?

Steve :-/Steve :-/

I don't know if it can be done with a VR, but if you're on EE or UE you can create a custom field, define it as Unique (No Duplicate Values Allowed) and create a WFR that passes the values to your Unique Field.

F SmoakF Smoak
@steve: I did that but I am not getting error from Workflow with the link of record but getting : Data Uniqueness Violation
The proposed data changes would violate a uniqueness constraint.