if(RecordType.Id = 'xxxxxxxxxxxx' && (FirstName = NULL || FirstName = " "), TRUE, FALSE)

The above formula is a Contact Validation Rule. It's supposed to stop anyone creating a contact of record type id xxxxxxxxxxxx without a first name. however it doesn't work and only works when i remove the recordtype part. Surely, because i choose the record type then enter name, salesforce knows what record type i'm using.


You should not use the RecordType.Id as this changes between different Salesforce Orgs, so if you develop in a sandbox then deploy to production the Validation Rule would fail.

Instead use the RecordType.DeveloperName in the formula so you would get

if(RecordType.DeveloperName = 'xxxxxxxxxxxx' && (FirstName = NULL || FirstName = " "), TRUE, FALSE)
  • amazingly that worked. no idea why it would prefer the name instead of the id. i understand your thinking about moving from sandbox to production but the formula should work or why offer it as an option. thanks for your help. – neo2049 Aug 17 '16 at 13:56
  • Formula should be more like RecordType.DeveloperName = 'xxxxxxxxxxxx' && (ISBLANK( FirstName ) || FirstName = " ") – o-lexi Aug 17 '16 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.