You need to sign in to do that
Don't have an account?
Validation rule for a lookup field's RecordType.Name
I'd like to create a validation rule that ensures that if a lookup field in my custom object is non-null, it refers to a record with a particular record type. I know how to write that validation rule using RecordTypeId:
myfield__r.RecordTypeId = "012800000006Rz1"
But the custom object containing this rule will eventually be packaged into an App Exchange offering, so I can't rely on the Id always being the same. How can I write this rule to check the field's RecordType.Name?
I've tried the following, but I get "Field RecordType does not exist"
myfield__r.RecordType.Name = "My RecordType Name"
Any ideas?
This is an old thread, but I was trying to do this and found a solution that doesn't require a hard-coded RecordType ID:
This fires the validation rule if the Campaign.RecordType.Name = "SpecialCampaign" and the custom CampaignID field is blank. This is packageable, since it's not using a hard-coded ID.
All Answers
This is an old thread, but I was trying to do this and found a solution that doesn't require a hard-coded RecordType ID:
This fires the validation rule if the Campaign.RecordType.Name = "SpecialCampaign" and the custom CampaignID field is blank. This is packageable, since it's not using a hard-coded ID.
TLF,
Way to update an old thread with a good answer! Thank you!
MJ.