-2

When I make a validation rule on phone number field that the phone number field should only contains number and only 10 digits allowed, but when making new records the phone number field is required, how I avoid it

3
  • 1
    Have you tried this? AND( NOT(ISBLANK(Phone)), REGEX(Phone, "^[0-9]{10}") ) Commented Aug 16, 2023 at 7:48
  • 1
    Welcome to SFSE! Please take the tour and read How to Ask. This isn't a place to get your work done for free, so you need to edit your question to show us what you've tried and point to a specific thing that you're having trouble with.
    – Derek F
    Commented Aug 16, 2023 at 10:59
  • It works thanks
    – Purnendu
    Commented Aug 16, 2023 at 11:01

1 Answer 1

0

Validation Rule Formula:

AND(    
    NOT(ISBLANK(Phone)),    
    REGEX(Phone, "^[0-9]{10}")
 )

ISBLANK function checks whether the field value is blank or not and the NOT function returns FALSE for TRUE and TRUE for FALSE.

REGEX function compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it returns FALSE.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .