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
praveen kumar 475praveen kumar 475 

validation rule for mobilenumber

Please help me to write validation rule for mobile number
Best Answer chosen by praveen kumar 475
DeepthiDeepthi (Salesforce Developers) 
Hi,

I have created a field called "Mobile__c" and worked on the below validation rule.
NOT(
AND( (LEN(Mobile__c)==16 ),(REGEX(Mobile__c,'[+91]{3}-[7-9]{1}[0-9]{2}-[0-9]{3}-[0-9]{4}')))
)

Best Regards,
Deepthi

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Hi Praveen,

There are to many example are available on google. I will recomend you to do some google. I hope below will help you
Example 1:-
Validation Rule for 10 Digit US phone number with 4 digit extension
https://help.salesforce.com/apex/HTViewSolution?id=000187896&language=en_US

Example 2:-
NOT(REGEX(Account__r.Phone,"[+91]{3}-[0-9]{3}-[0-9]{3}-[0-9]{4}"))
Example 3:-
Validates that the Phone number begins with a plus sign (+) for country code. Note that this validation rule conflicts with the ten-digit rule.
LEFT(Phone, 1) <> "+"
Example 4:-

Validates that the Phone number is in (999) 999-9999 format. This works by using the REGEX function to check that the number has ten digits in the (999) 999-9999 format.
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}"))

Let us know if this will help you

Thanks
Amit Chaudhary
DeepthiDeepthi (Salesforce Developers) 
Hi,

I have created a field called "Mobile__c" and worked on the below validation rule.
NOT(
AND( (LEN(Mobile__c)==16 ),(REGEX(Mobile__c,'[+91]{3}-[7-9]{1}[0-9]{2}-[0-9]{3}-[0-9]{4}')))
)

Best Regards,
Deepthi
This was selected as the best answer
praveen kumar 475praveen kumar 475
Thank you deepthi. this is the validation  i am looking for
praveen kumar 475praveen kumar 475
Amit, u too given a nice explanation thank you so much guys