+ Start a Discussion
Antone KomAntone Kom 

Dependent picklist values based on record type, on VF page with list controller when record set spans multiple record types

Hi all,

I've seen lots of topics and discussions here about picklist values based on record type on a standard VF page, but I have a little more complicated problem.

I am trying to get around the problem mentioned here: https://success.salesforce.com/ideaView?id=08730000000BpNb

I have built a visualforce page with a standard list controller and no extensions, with a custom list view button to open the page after several case records have been selected.

The VF page contains 2 picklists: Status and SubStatus (dependent picklist, with different values based on Case record type).

The problem I am facing is this: How does Salesforce decide which set of SubStatus values to show in the dropdown, if I have selected multiple records on the list view that may have different record types?

At the very least, I want to be able to show ALL possible values, regardless of selected records' record types.

I was trying to build this without custom controllers or extensions, but I think I may have to build the SubStatus picklist dynamically.

Any advice or tips how to do this?  

VF Page:
<apex:page standardController="Case" recordSetVar="cases" tabStyle="Case">
    <apex:form id="form">
        <apex:pageBlock title="Mass Close Cases" mode="edit" id="block">
            <apex:pageMessages />
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            <apex:pageBlockSection title="Case Information" columns="1" id="section">
            <apex:pageBlockSectionItem id="sectionItem1">
                <apex:outputLabel value="Status" />
                <apex:inputField id="statusval" value="{!case.Status}"/>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="SubStatus" />
                <apex:inputField required="true" Value="{!case.SubStatus__c}"/>
If you are not mentioning record type specifically during record creation, salesforce selects the default record type and shows picklist values based on that record type.

Either you can create a default record type with all picklist values available for it or else as you suggested go for custom controller
Antone KomAntone Kom
These records already exist... you can select them from the list view using the checkboxes, then clicking the button takes you to the VF page where you set the new Status and SubStatus for all the selected records.  But those selected records may each have different record types.
Antone KomAntone Kom
User-added image
User-added image

The problem is that some of the Case record types have SubStatus values that are only visible for those types, and they are not visible in the dropdown on the VF page (screenshot above).  I am not sure how Salesforce decides which set of picklist values to display here.  Is it based on my profile's default record type or something like that?

I need to find a way to get the missing picklist values to appear in this list.
Manisha PatilManisha Patil
Did you ever get a solution for this?