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

Determine Which Picklist Values To Display For Dependent Picklist

Hi,  I am trying to retrieve picklist values via apex using the following code.


List<SelectOption> optionList = newList<SelectOption>();

optionList.add(new SelectOption('', '- None -'));

Schema.DescribeFieldResult field = Product_Services__c.Service__c.getDescribe();


for(Schema.PicklistEntry f : field.getPicklistValues()) {

  optionList.add(new SelectOption(f.getValue(), f.getLabel()));




This works fine except it displays all the values available in the picklist. There is actually a controllingField "Product_Categories" which determines which picklist values should be displayed/used.


If I wish to use this controllingField and only display correct results for Product_Categories   "A" or "B" do you know how I do this?




Hi,  Adding to my original question. What binds a picklist value to a dependent picklist value.  I.E. where is this stored?  As it is based on a field I guess there is no object for this?  I'm wondering as it may help to determine how to search for one picklist associated to another dependent one.