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
Pranathi AnukuriPranathi Anukuri 

Write a validation rule for Phone Number is equal to 10 digits and 13 digits only then only the record should create

Write a validation rule for Phone Number is equal to 10 digits and 13 digits(if the user gives 11 and 12 digits also the error should throw) only then only the record should create,otherwise the error should throw.
Khan AnasKhan Anas (Salesforce Developers) 

Hi Pranathi,

Greetings to you!


Try below validation rule. Phone Number will save if the values meet the following requirements:

  • Phone numbers should be 10 or 13 digits in length only
  • Only numbers are accepted
  • "+" symbol at the beginning of the number is acceptable
 
OR( 
  OR( 
    LEN( Phone ) <= 9 , 
    LEN( Phone ) = 11, 
    LEN( Phone ) = 12, 
   LEN( Phone ) >= 14 
  ), 
  NOT( 
    OR( 
      REGEX(Phone, "[0-9 ]+"), 
      REGEX(Phone, "\\+[0-9 ]+")
    ) 
  ) 
)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Iqbal_AhmedIqbal_Ahmed

Hi Pranathi,
Try this one :) 
 

NOT(
 OR(LEN(Phone) == 10,LEN(Phone) == 13)
)
 


Let me know if it helps you :) 

Thanks and Regards,
Iqbal Ahmed

Keira ArnotKeira Arnot
A validation rule for phone numbers has been described and discussed here. People can write a validation rule by considering the rules and guidelines which are given on this blog page (www.cnumber.co.uk/numbers/0370-numbers/) and cNumber also important for 0370 numbers. This blog post contains much important information.