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
sliptonslipton 

AND(OR()) Problem - Statements working separately but not when nested

I feel like I'm going crazy here.  The first two validation rules below work fine when used individually:

 

AND(
$Profile.Name != 'Profile 1',
ISCHANGED( RecordTypeId ))

 

--

 

AND(
$Profile.Name != 'System Administrator',
ISCHANGED( RecordTypeId ))

 

Yet the below throws the error, either when logged in as System Administrator or as Profile 1.  

 

AND(
OR(
$Profile.Name != 'System Administrator',
$Profile.Name != 'Profile 1'),
ISCHANGED( RecordTypeId ))

 

I can't seem to work it out yet I get the feeling it's going to be a simple solution.  Thanks in advance for the help.

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Try something like this: 

 

AND(
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile 1",
ISCHANGED( RecordTypeId ))

 

All Answers

Steve :-/Steve :-/

Try something like this: 

 

AND(
$Profile.Name <> "System Administrator",
$Profile.Name <> "Profile 1",
ISCHANGED( RecordTypeId ))

 

This was selected as the best answer
sliptonslipton

That works.  Thanks Stevemo!

 

It appears the flaw was in my logic.  Can I ask why my solution didn't work?