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
Terry_0101Terry_0101 

Prevent two fields from being equal

How to prevent a record save if two fields on an object have same values?
Anupam RastogiAnupam Rastogi
Hi Samantha,

You can create a validation rule that checks if the two fields on the same record are same or not. If they are same then throw an error.

I hope this helps.

Thanks
AR

If you found the reply useful that solves your query then please mark it as best.
 
KaranrajKaranraj
Create a validation rule on the object where Field1 = Field2 then throw your error message saying that both fields should not be equal
Field1 = Field2


 
Ravikant kediaRavikant kedia

Hi Samantha,
In this situation vlookup is a best option in which you can prevent user to save a duplicate record,
below is the link how to create vlookup function.
https://success.salesforce.com/answers?id=90630000000gyFzAAI
Terry_0101Terry_0101
Does this work?  Field1 = Field2
Anupam RastogiAnupam Rastogi
Are you looking for same values of a field in different records or in the same record?
Terry_0101Terry_0101
same record
Anupam RastogiAnupam Rastogi
Hi Samantha,

As replied earlier, you can create a Validation Rule that checks if the two field values are same and then throw an error.

Thanks
AR
 
Krutik YadavKrutik Yadav
Hey Anupam Rastogi, I am looking for same values of a field in different  records. What is the solution for that validation rule?