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
cmoylecmoyle 

Missing Field Values

I have 3 dependent picklists set up in my Case object and when I place the fields on my visualforce page via <apex:inputField>, they are missing some of the field values that should be displayed in the picklists. I have verfied that they are selected in the dependecy matrix, and checked that no Record Types or workflows would have them removed as well. Is there something that I'm not thinking of that drives the display for picklists in a visualforce page?

NzgonNzgon

Cehck your API used for page

  Dependent picklists can only be displayed onVisualforce pages with a Salesforce.com API version 20.0 or higher.



Adding Dependent Fields to a Page

Dependent fields provide a way to filter the field values displayed on a Visualforce page. Dependent fields consist of two parts: a controlling field that determines the filtering; and a dependent field that has its values filtered. Dependent fields can dynamically filter values in fields such as picklists, multi-select picklists, radio buttons, and checkboxes. Dependent picklists can only be displayed on Visualforce pages with a Salesforce.com API version 20.0 or higher. For more information, see About Dependent Picklists in the Salesforce.com online help.

For this example, we'll be adding a dependent picklist, Subcategories, to a Visualforce page. First, create this custom picklist:
  1. Click Your Name | Setup | Customize | Accounts | Fields
  2. Click New in the Custom Fields & Relationships section of the page.
  3. Choose Picklist and click Next.
  4. Enter Subcategories for the Field Label.
  5. Enter the following terms for the list of values:
    • Apple Farms
    • Cable
    • Corn Fields
    • Internet
    • Radio
    • Television
    • Winery
  6. Click Next twice, then click Save.
To define the field dependencies for Subcategories:
  1. Click Your Name | Setup | Customize | Accounts | Fields
  2. Click Field Dependencies.
  3. Click New.
  4. Choose Industry as a controlling field, and Subcategories as a dependent field.
  5. Click Continue.
  6. Each value in the controlling field (from Industry) is listed in the top row and each value in the dependent field (from Subcategory) is displayed in the column below it. Set your field dependencies to match this image:
    The Field Dependency Matrix for Subcategories
    The field dependency matrix for Subcategories
    You can disregard any other Industry types that aren't shown above.
  7. Click Save.
Now, create a Visualforcepage calleddependentPickliststhat looks like this:
<apex:page standardController="Account"> <apex:form > <apex:pageBlock mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Dependent Picklists" columns="2"> <apex:inputField value="{!account.industry}"/> <apex:inputField value="{!account.subcategories__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
When you select Agriculture from the Industry picklist, the Subcategories picklist contains Apple Farms, Corn Fields, and Winery. If you select Communication, your Subcategories picklist contains all the Communication types defined earlier.
Dependent Picklist Considerations
Consider the following when using dependent picklists in Visualforce pages:
  • You can mix controlling and dependent fields across various field types, such as picklists, multi-picklists, radio buttons, and checkboxes.
  • There's a limit of 10 dependent picklist pairs per page. This is totalled across all objects. Thus, you could have five dependent picklists on Account, and five on Contact, but no more. However, you can repeat the same pair of dependent picklists, such as in an iterative tag like <apex:repeat>, without counting more than once against your limit.