[SalesForce] Validation Rule with $RecordTypeId

I need to write a validation rule based on the recordTypeId.
I would like to make sure that when the users selects a record via a lookup field the rule will check if the record chosen is of a specific RecordType.

How can I use the $RecordTypeId or $RecordTypeName in the validation rule formula to achieve this?

Best Answer

We started the practice of putting a custom field on any object that we would use a record type for called "Record Type Name".

It's a formula field that has value $RecordType.Name

This lets you refer to record types by name in Apex without having to do an extra query, but it may also keep things simpler for validation rules.

Related Topic