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
srikanth j 24srikanth j 24 

validation rule for mobile no

I have 1 field called contact no in student obj actually mobile no 10 digits right if i enter more than 10 digits i want to show error message using validations how can i approach this can anyone help me .
Adv thanks 
Best Answer chosen by srikanth j 24
JyothsnaJyothsna (Salesforce Developers) 
Hi Srikanth,

Please try this validation rule it allows only 10 digits.
 
NOT(REGEX( phone__c , "\\D*?(\\d\\D*?){10}"))
Hope this helps you!

Please mark the answer as Best Answer if it really helped so that it would help others as well in future.

Best Regards,
Jyothsna
 

All Answers

SalesFORCE_enFORCErSalesFORCE_enFORCEr
Convert the mobile number to text and then check the length.
LEN(TEXT(Phone__c))>10 throw error.
JyothsnaJyothsna (Salesforce Developers) 
Hi Srikanth,

Please try this validation rule it allows only 10 digits.
 
NOT(REGEX( phone__c , "\\D*?(\\d\\D*?){10}"))
Hope this helps you!

Please mark the answer as Best Answer if it really helped so that it would help others as well in future.

Best Regards,
Jyothsna
 
This was selected as the best answer
srikanth j 24srikanth j 24
Thank u Jyoshna
srikanth j 24srikanth j 24
Could you explain that formula in detail .