Reputation: 63
I have a custom field called Email_address and I want to set-up a validation that sends an error message if the email isn't a gmail address. How would I set this up?
Also, is there a way to send an error message if the email address isn't unique?
Thanks so much!
Upvotes: 0
Views: 1574
Reputation: 1191
I don't know what you mean by 'send an error.'
If you want to prevent incorrect entry, use a validation rule. I'd generally use a regular expression to evaluate something like an email address, but if you're uncomfortable with them you can also use something like RIGHT(my_field__c, 9) <> "gmail.com"
. If, for some reason, you want to be notified of incorrect email addresses but still allow them to be entered, you can use a workflow that behaves mostly the same way.
Preventing duplicate email addresses is a bit more difficult unless you want to venture into trigger-land, which is massive overkill for something like this IMHO. You can make the field a unique ID in the custom field creation wizard (although I believe you only get a finite number of these), but other than that I don't know of a way that doesn't involve a trigger and a SOQL query.
Upvotes: 1