I'm trying to create a validation rule for Phone Numbers. Say, I have three Phone Number fields that should be checked if the values meet the following requirements:
- phone numbers should be 10-12 digits in length
- only numbers are accepted
- "+" symbol in the beginning of the number is still acceptable
I came up with a rule using REGEX but it only accepts numbers that start with +. Clearly not the requirement since putting + in the beginning is just optional.
This is my rule so far:
NOT(
AND(
OR(
LEN(Phone) = 0,
REGEX(Phone, "\\+[0-9 ]+")
),
OR(
LEN(MobilePhone) = 0,
REGEX(MobilePhone, "\\+[0-9 ]+")
),
OR(
LEN(OtherPhone) = 0,
REGEX(OtherPhone, "\\+[0-9 ]+")
)
)
)
I'm hoping if you can spare some time to help me with my validation rule. I'm still new to Salesforce so I'm still figuring things out. Thank you.