You need to sign in to do that
Don't have an account?
cldave
Validation to compare multiple fields for Duplicate Data
Hi,
I'm trying to create a validation to be able to compare about 35 email fields (from same record) to see if any have duplicate data.
Basically if example email1 and email 7 have same email address validation should prevent me from saving until it is fixed
I'm at a lost on where to start :( If anyone could help, I would appreciate it
Thank you in advance
I'm trying to create a validation to be able to compare about 35 email fields (from same record) to see if any have duplicate data.
Basically if example email1 and email 7 have same email address validation should prevent me from saving until it is fixed
I'm at a lost on where to start :( If anyone could help, I would appreciate it
Thank you in advance
You could either write 35 validation rules with 34 lines of comparision in each, or you could create a trigger with before update & before insert events, check the same logic and return an error accordingly!
Either way the logic in both cases will have similar lines of code!, but in trigger, we can have a better logic written, where we can easily check the number of occurences of each email entered, if it is greater than 1 throw an error.
Hint: If it is in trigger, you can serialize the record you are dealing witha and verify the number of occurances of each email field.
I dont see any other option other than these two :).
Hope it helps.
thanks,
balaji
All Answers
You could either write 35 validation rules with 34 lines of comparision in each, or you could create a trigger with before update & before insert events, check the same logic and return an error accordingly!
Either way the logic in both cases will have similar lines of code!, but in trigger, we can have a better logic written, where we can easily check the number of occurences of each email entered, if it is greater than 1 throw an error.
Hint: If it is in trigger, you can serialize the record you are dealing witha and verify the number of occurances of each email field.
I dont see any other option other than these two :).
Hope it helps.
thanks,
balaji
But tyvm for info, I appreciate it