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
TiborMTiborM 

custom picklists dependencies in visualforce page

Hi,

 

i have problem with picklist dependencies.

 

What I want to do:

Salesforce have integraetd Mass Case Close function, but we cant change layout of this page. Therefore we want build our custom visualforce page and put there all fields which we need.

 

My steps :

 

1. Create custom picklist which is dependent on standard picklist

 I've created Reason Code Specification (REASON_CODE_SPECIFICATION__c) field which is dependent on Case Reason (Reason) standard field.

2. i've created matrix of dependencies

3. i've created visual force page

<apex:page standardController="Case" recordSetVar="cases" tabStyle="Case">
<apex:form >
    <apex:pageBlock title="Mass Close Cases" mode="edit">
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        
        <apex:pageBlockSection >
            <apex:inputField value="{!Case.Status}"/>
        </apex:pageBlockSection>

        <apex:pageBlockSection >
            <apex:inputField value="{!Case.Reason}"/>
            <apex:inputField value="{!Case.Case_Reason_Specification__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
You have selected cases with IDs: {!selected}.
</apex:page>

 This page accept all selected items from List View Button.

 

4. I've created List View Button for Case object

 Label: My own mass close

 Behavior: Display in existing window with sidebar

 Display type: List button

 Display Checkboxes (for multi-record selection): True

 Content Source: Visualforce page

 Visualforce Page: is page above

 

Now when I go to CASES tab and select some view I can see this button :) it's still OK :)

When I select some case and press my own Mass close button I was redirected to visualforce page.

But there is problem. When I select some Case Reason i still can select all of other values from Case Reason Specification even if I make field dependency.

 

I want update all {!selected} cases with this code and tpe values just once. I don't want type values for all seleced items, but only once for all selected records.

 

Please help how can I do this?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AvromAvrom

So, there are a couple of possibilities, here:

 

1) Dependent picklists are only supported in VF starting with Summer '10, which has currently in the middle of rollout. What instance are you on? You may not have gotten it yet.

 

2) Assuming you've gotten it, you need to make sure your page is using the latest API version (19). For reasons of backwards-compatibility, only pages with new API versions have dependent picklist support.

 

All Answers

AvromAvrom

So, there are a couple of possibilities, here:

 

1) Dependent picklists are only supported in VF starting with Summer '10, which has currently in the middle of rollout. What instance are you on? You may not have gotten it yet.

 

2) Assuming you've gotten it, you need to make sure your page is using the latest API version (19). For reasons of backwards-compatibility, only pages with new API versions have dependent picklist support.

 

This was selected as the best answer
TiborMTiborM

Thank You. I used version 18. After switch to 19 everything working fine.

suresh.csksuresh.csk

How to switch the API version from 18 to 19 in sanbox and also in prodtcion

TiborMTiborM

you must click EDIT on your page and you will see VERSION BUTTON on top of editting window.. jusk click there and switch versions

suresh.csksuresh.csk

Thanks a lot.

It works Fantastic.