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
Pedro Muller LopesPedro Muller Lopes 

Validating multiple number formats in one validation rule

Hi,

I am trying to validate the phone number on the contact according to multiple formats. I want users to be able to enter phone numbers that match one of three formats, one starting with "+" , another starting with "00" and finaly one starting with "(".

I can create all of the these as single validation rules, but when I try to combine two or more, I am struggling wiht the logic even if the syntax of the formula is correct.

Any suggestions?
Best Answer chosen by Pedro Muller Lopes
Pedro Muller LopesPedro Muller Lopes
Hi solved this using a combination of NOT and BEGINS.
 
NOT( 
OR(Begins(Phone,"+"),Begins (Phone, "("),Begins (Phone, "00") 
))

This did the job!

All Answers

Sathish VenkatSathish Venkat
Have you tried REGEX function in the validation rule to include all 3 formats?
Akhil AnilAkhil Anil
Can you post the formula that you have used in the individual rules so that we can help you merge them ?
Pedro Muller LopesPedro Muller Lopes
Hi @Akhil , I have used a simple AND / BEGINS combination.
 
NOT(AND(BEGINS(Phone, "+") ))

So this work for both "00" and "(" as individual rules, but as a combination... I get a bit lost as I can't seem to be able to get an OR logic.

I have also tried with a LEFT function and it also works for individual rules.

I tried REGEX, but since I only need the first character(s) to of a specific kind, regardless of how many digits follow, I am not sure how to use it.
Pedro Muller LopesPedro Muller Lopes
Hi solved this using a combination of NOT and BEGINS.
 
NOT( 
OR(Begins(Phone,"+"),Begins (Phone, "("),Begins (Phone, "00") 
))

This did the job!
This was selected as the best answer