You need to sign in to do that
Don't have an account?

how to write trigger for phone number validation
hi friends,
how to write trigger for phone number validation
You need to sign in to do that
Don't have an account?
hi friends,
how to write trigger for phone number validation
You can use REGEX in apex to accomplish your requiement. Following links will be helpful for you
http://www.forcelabs.net/2011/07/regular-expression-to-validate-phone.html
http://forceguru.blogspot.com/2011/06/using-regex-in-validations.html
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
If you want to check the format of the phone number then you can go for a validation rule itself instead of a trigger.
You can use the REGEX function to to phone validation.
Hi,
I couldnt get what are you asking for and Why trigger? While creating the field you can specify it as "Phone" and if you need a validation to check it should contain 10digits you can write a validation as:
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
This validation checks that phone no. is in (123) 456 7890 format.
If this is not your requirement, please tell me you requirement.