• MSubs
  • 0 Points
  • Member since 2009

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
I'm trying to create a validation rule using the new VLOOKUP function.  The idea is:
* Registrations are detail-master to Programs
* Faimly Groups are also detail-master to Programs
* Registrations has lookup relationship to Family Groups
* want to limit so that you can only choose a Family Group that belongs to the same Program that the Registration belongs to

So basically this is a workaround to get around the lack of filtered lookups.

I tried writing the validation rule to look like this:

NOT ( 
VLOOKUP( $ObjectType.Family_Group__c.Fields.Program__c ,  
$ObjectType.Family_Group__c.Fields.Id , Family_Group__r.Id ) = Program__r.Id )

 However, this gives me an error of "Incorrect parameter for function VLOOKUP(). Expected Record Name field." which is rather inscrutable, I'm sure you'll agree.

From experimentation, I've found that it works if I replace those Id fields with Name fields.  However, I don't want to do that, as Family Group names are not necessarily unique.

Why doesn't it work with the Id's?  Is there some reason that this function won't accept Id fields as parameters?  If so, is that something that could be changed?  This is probably the most important potential use of this function in validation rules.

BTW, the documentation is not clear on this.  The only thing it says is "The field_on_lookup_object must be an indexed field."  But I can't find anywhere what constitutes an Indexed Field in SFDC, so that's not too helpful.

Thanks for any help!


  • February 16, 2008
  • Like
  • 0