+ Start a Discussion

Dependent picklists in VF page.



I am presently working on Sites.


I have 3 picklist fields on Product Object. Let them be as A, B,C.


B is Dependednt on A, and C is dependent on B. 


I cannot display picklists fields of Product sobject in Sites, as I have only Read permission over that object.


So, I decided to display picklist values by calling describe method for field name of every object.


I am using


 Schema.SObjectField F1 =product2.A;



In the same I can get the values of 3 picklists.

But, How can I get the dependencies that exist among them.








Dear Charan,


These two articles describe rolling your own dependent picklists.


Force Tips : Creating A Dependent Picklist



Discover the Advanced Capabilities of Visualforce - Part 2



However I see you are asking how to get the controlling item from schema. This is not a complete answer, but check these out. Perhaps the validFor field is the answer?


"In the Field object associated with the DescribeSObjectResult, the picklistValues field contains an array of PicklistEntry properties. Each PicklistEntry can contain any one of the following string values. "

  validFor  /  byte[]  /  A set of bits where each bit indicates a controlling value for which this PicklistEntry is valid. See About Dependent Picklists.





Hope this helps,