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:
- Click Insert Field
- Select
Salad >
in the first column - Select
Fruit >
in the second column - Select
Fruit Name
in the third column - Repeat for Vegetable
Attribution to: Mike Chale
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1490