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

Simple Validation Rule question (regarding Record Type)


I'm trying to limit Record Type to be of a certain kind for one of my objects. the rule is very simple, but it doesn't work:

Validation Rule:
Staff_Member__r.RecordTypeId <> "01220000000DGbBAAW"

In other words, I only allow Staff Members to be of record type "012...AAW" . I did check that this is the correct record type ID.

My rule fails in the following way. it disallows membership of any kind. in other words, it always evaluates to True.

Any ideas?

Thanks so much
Best Answer chosen by Admin (Salesforce Developers) 

This is for future reference for any person stuck with the same problem. the issue was solved by salesforce support:

The record type ID you are referencing (01220000000DGbBAAW) is an 18 character case-insensetive ID which was extracted from via the API. The issue is that the UI only uses a 15 character case-sensitive ID (e.g.  01220000000DGbB). Since 01220000000DGbB is not equal to 01220000000DGbBAAW your rule is always returning 'true'.

Please try the following syntax instead:

Staff_Member__r.RecordTypeId <> "01220000000DGbB"


It did the trick.