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
Alex Christensen 1Alex Christensen 1 

RGEX Validation Rule issue

I created a RGEX formula to only allow for spaces and alphabetical letters when creating a contact. However, the rule only needs to be implemented for two profiles. When I add the profile name into the formula it blocks the user from creating a contact completely even if both fields are filled out correctly. 

OR(NOT(REGEX(FirstName,"^[a-zA-Z_ ]*$")),NOT(REGEX(LastName,"^[a-zA-Z_ ]*$")))&& $Profile.Name = "Customer Support" || $Profile.Name= "Technical Support"
Best Answer chosen by Alex Christensen 1
VinayVinay (Salesforce Developers) 
Hi Alex,

Try below snippet.
AND(
OR(NOT(REGEX(FirstName,"^[a-zA-Z_ ]*$")),NOT(REGEX(LastName,"^[a-zA-Z_ ]*$"))),
OR(($Profile.Name = "Customer Support"),($Profile.Name= "Technical Support"))
)

Please mark as Best Answer if above information was helpful.

Thanks,