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
Deepika GhoseDeepika Ghose 

How to write validation rule for checking 10 digit mobile no and it should not accept any thing except no.

MANCHA PANDURANGASATYANARAYANAMANCHA PANDURANGASATYANARAYANA
phone or mobile no is validation rule below the formula
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))
sairam v 9sairam v 9
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))

It is right method for Validate phone number 10 digit and text.
karthikeyan perumalkarthikeyan perumal
Hello, 

 we have use Text Field with regex validation rule for saving the record in Exact phone Number formate like 

Create a Text Phone_c custom field 
add the validation rule for this field

NOT(OR(REGEX(Phone__c, "^[0-9]{10}")))

its give you the exact result what you want. 

Hope it will help you to solve your issue. 

kinldy mark Best ANSWER if it works for you. 

Thanks
karthik
Anilkumar KotaAnilkumar Kota
Hi Deepika ,

I guess it should be as simple as this:

          NOT(REGEX( Phone, "(\\d){10}"))

           This means that "Only Allow 10 digits". d - stands for DIGITS and {10} - just 10 of them.
Igor PetrovychIgor Petrovych
If you need a more advanced validation of a number, to make sure you really have a valid number - you can do that in the trigger handler, and use a ported libphonenumber (http://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G12oJUAR) library.