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
beenerbeener 

Record Type Validation

Hi, 

 

until now, I had some validation rules for record types. It was hard coded: here's an example:

 

 

Staff_Member__r.RecordTypeId <> "01220000000BGkB"

This Validation rule limits the type of record allowed in this reference.

 

However, hard coding anything is offcourse bad practice, and leads to much work when working with the sandbox, because (I think) all new record Type ID numbers are generated.

 

I was attempting to replace this rule with a sandbox sensitive formula.

 

I've tried different variations of the following :

Staff_Member__r.RecordTypeId <> VLOOKUP($SobjectType.id , $SobjectType.name, "Client")

 

 

but I could not get it to work. Any ideas?

 

Thanks,

 

Ben 

 

werewolfwerewolf
Within validation rules you can use $RecordType.DeveloperName, or other members of $RecordType as you see fit.
beenerbeener

HI, 

 

I have tried $RecordType.Name as wall as $RecordType.DeveloperName in my validation rules: only to get the following respective errors:

 

Error: Field $RecordType.Name does not exist. Check spelling. 

Error: Field $RecordType.DeveloperName does not exist. Check spelling. 

 

I have not found documentation on these fields with regards to validation rules.

 

Any help would be appreciated, at the moment I hardcoded the record type ID's and that sucks.

 

Thanks

 

Ben  

werewolfwerewolf

Well, I used the Insert Field button to insert it, but I just made this validation rule and it worked just fine:

 

$RecordType.DeveloperName = "Billing"

 

I'm not sure what's up with that.  Maybe it's a new feature on Spring '10 and you haven't been upgraded yet?  I'm on Spring '10 now because I'm on NA1.

beenerbeener

I hope you are right. i'm on EU0 where the spring release was just postponed to sometime in March (Arghh!!!)

 

In the mean Time I disable / hard code the validation rules for testing and hold my fingers crossed...

 

 

So I take it that before Sprint '10, folks would hard code Record Type Validation rules?

 

Thank you.

Ben