Find your content:

Search form

You are here

Creating validation/filter/error/other rules for selecting records in a look-up field

 
Share

Let's say I have a custom object called SALADS. SALADS has two field look-up relations to custom objects FRUITS and VEGETABLES. How would I go about creating a rule/error saying that, while creating a record for SALADS, if I selected "Apple" from the FRUITS look-up I couldn't select "Lettuce" from the VEGETABLES look-up? Thanks in advance!


Attribution to: sharrie

Possible Suggestion/Solution #1

You could build your validation rule to compare the object names. Assuming your lookup fields are named Fruit__c and Vegetable__c, with name fields the default Name, your validation rule would look like:

(Fruit__r.Name = "Apple") && ( Vegetable__r.Name = "Lettuce")

The field names were found by:

  1. Click Insert Field
  2. Select Salad > in the first column
  3. Select Fruit > in the second column
  4. Select Fruit Name in the third column
  5. Repeat for Vegetable

Attribution to: Mike Chale
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1490

My Block Status

My Block Content