[SalesForce] Validation rule to prevent creating records of certain record type not working

I have the following validation rule to prevent a certain user from creating Account records of certain recordtype. However it is not working. The user can create records of this record type.

AND(
  ISNEW(),
  RecordTypeId = "012Z0000000ZXxXXXXX",
  $User.Alias = "something"
)

Best Answer

Issue might be related to record-type id or User aliasname.

Instead of hardcoding the id's you can use RecordType.DeveloperName = "API name of record type" or RecordType.Name = "Label name of record type". If you still want to use Recordid try using "RecordType.Id"

enter image description here

RecordType documentation