[SalesForce] Record Type Validation Rule

I have written a validation rule, which checks whether a certain picklist has a certain value. The reason for this is, when someone changes the record type of account, then the picklist has different values that are allowed for that record type, however we need a validation rule, because the user can save with an invalid value otherwise.

I have written the following, however nothing happens:

AND( 
$Profile.Name <> 'Admin', 
RecordType.DeveloperName = "New Accounts", 
NOT(ISPICKVAL(Stages__c ,"Stage 3")) 
)

Basically what I want to say here is that if the record type name is New Accounts, then fire the validation rule if stages is NOT set to Stage 3.

Tia, Lily.

Best Answer

DeveloperName is not the same as Name. It has special restrictions, much like API names (can't start with a number, no spaces or punctuation, etc). Check the Developer Name attribute of your record type. The formula editor won't throw an error, but you'll never match a DeveloperName to a string that contains spaces.

From the documentation:

Required. The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.