1
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.

1 Answer 1

1

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)
2
  • 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
    Commented Aug 17, 2016 at 13:56
  • Formula should be more like RecordType.DeveloperName = 'xxxxxxxxxxxx' && (ISBLANK( FirstName ) || FirstName = " ")
    – o-lexi
    Commented Aug 17, 2016 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .