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
David VPDavid VP 

Is it possible to retrieve picklist dependencies via Apex ?


In a visualforce page I have a need for displaying picklist entries. The problem is that this field depends on another picklist field. Is there a way to get to the dependencies somehow ?

I'm stranded at :

for(Schema.PicklistEntry p:Schema.sObjectType.Case.fields.getMap().get('Dependent_Field__c').getDescribe().getPicklistValues()) {

This gives me all the values. However, I would like to be able to single out the values that correspond to a certain value in the controlling field ...

Thanks for your help,

I have this same issue and have not been able to find a workaround.

David VP - did you ever come up with a solution?
David VPDavid VP

Till this day I haven't found a clean solution for this. For the time being the values are hard coded in our page.

So the question is still up for grabs ... anyone ?


I am not sure if this helps you...

For my case (getting campaign member status), I retrieve all statuses related to a campaign using SOQL into a list of SelectOption in my Visualforce page controller then display/bind the variable in a VF page.
I have the same problem, any solution with the new release?