I have a pair of dependent picklists. In Apex code, how can I determine what options are valid in the dependent field for each option in the controlling field?
I've tried using getPicklistValues(), but there doesn't seem to be any way of getting dependency information.
Example
Controlling_Field__c
Fruit, Vegetable, Dairy
Dependent_Field__c
(Fruit): Apple, Banana, Pear
(Vegetable): Tomato, Egglant, Lettuce
(Dairy): Milk, Cheese, Yogurt
What I'm Looking For
(In pseudocode, something like:)
controllingOptions = dependentfield.getPicklistValues();
for (option : controllingOptions) {
dependentOptions = dependentfield.getPicklistValuesFor(option);
do_something_with_it();
}