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
Michael Sabel 9Michael Sabel 9 

How can I exclude a specific Record Type from a Validation Rule?

Here's the formula I am using for a Validation Rule to require a specific phone number format be entered (xxx) xxx-xxxx. This formula works for me.

AND(
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

Is there anything I can add to the formula to prevent it from firing on a specific record type? Let's call it "Record Type A".

Thanks.
Best Answer chosen by Michael Sabel 9
Andrew GAndrew G
AND(
NOT(RecordType.Name = "Record_Type_A"),
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

HTH
Andrew
 

All Answers

Andrew GAndrew G
AND(
NOT(RecordType.Name = "Record_Type_A"),
NOT(ISBLANK(HomePhone)),
NOT(REGEX(HomePhone, "\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}"))
)

HTH
Andrew
 
This was selected as the best answer
Michael Sabel 9Michael Sabel 9
Thank you.
Michael Sabel 9Michael Sabel 9
What if I want to exclude records from an object that doesn't have any record types? Would you be able to show me how that looks? Thanks much. Mike