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
1 Answer
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.
AND( NOT(ISBLANK(Phone)), REGEX(Phone, "^[0-9]{10}") )