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
MRivasMRivas 

Can I have many phone fields in one validation rule?

Hi Can I have many phone fields in one validation rule? For example, phone, work, mobile and emergency contact. I am using this formula. So my question is can I add more fields to this formula and if so, HOW? I have tried different things and no luck. 


AND(
OR(
ISNEW(),
ISCHANGED(Phone)
),
NOT(ISBLANK(Phone)),
NOT(REGEX(Phone, "\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$"))
)

VinayVinay (Salesforce Developers) 
You can use OR condition in validation rule.  Something like below.
 
AND(
OR(
ISNEW(),
ISCHANGED(Phone)
),
NOT(ISBLANK(Phone)),
OR(NOT(REGEX(Phone, "\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$")),NOT(REGEX(Mobile, "\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$")),NOT(REGEX(OtherPhone, "\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$")))
)

Please mark as Best Answer if above information was helpful.

Thanks,
MRivasMRivas
It doesn't seem to be working maybe I have somethign wrong at the begining. 
Vineela ProddaturuVineela Proddaturu
Hi MRivas
Please,try below formula
AND(
OR(
ISNEW(),
ISCHANGED(Phone)
),
AND(  NOT(ISBLANK(Phone)), 
NOT(REGEX( Phone,"(\\D?[0-9]{3}\\D?)[0-9]{3}-[0-9]{4}")) )
Molly VaynerchuckMolly Vaynerchuck
I have tried all the tips and tricks. Nothing is working for me. I don't know what is happening. There is any mistake in the answer or anything else.