I have a custom object. I want to put in a business rule so that a combination of two fields must be unique.
So I have Field1 and Field2 and want the combination to be unique:
Field1=4, Field2=7 Field1=4, Field2=8
is ok
But,
Field1=4, Field2=7 Field1=4, Field2=7
is not ok
What is the easiest / best way to do this?
Thanks.
Answer
The easiest way to do this is to create a Unique Text field
. Then, concatenate the values of the two fields together and update your Unique Text Field
with the resulting value using a Workflow Field Update
or a before Trigger
.
Smashing the two fields together would essentially create a composite key that can be used to verify uniqueness.
Attribution
Source : Link , Question Author : dublintech , Answer Author : Kevin O’Hara