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
Mack DsozaMack Dsoza 

How to display picklist value...

How to display all sub pickllist value ?


I have one field (picklist) as General_Expense__c which has certain list of values like abc, def, ghi etc...

Also have one another field (picklist as well as controlling field is General_Expense__c) which has list of values as a,b,c,d,e,f...


Now whenever I select any field from general expense then its appropriate list of fields should appear like this..


abc --> Selected    a



def --> Selected     d



ghi --> Selected     g




Chamil MadusankaChamil Madusanka



You have to create dependant pick lists for achieve this. Try following steps;


Create two pick lists with your values in a particular object


            Ex: PickList1 (values: abc,def,ghi)

                   PickList2 (values:a,b,c,d,e,f,g,h,i)


Click field dependencies at Custom Fields & Relationships which is under your object


Click New


Select PickList1 as  Controlling Field


Select PickList2 as  Dependent Field


Click Continue


Then you can select your dependant values


Use following code for implement the dependant pick list in VF page


<apex:page standardController="yourObject__c">
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageBlockSection title="Dependent Picklists" columns="2">
            <apex:inputField value="{!yourObject__c.PickList1__c}"/>
            <apex:inputField value="{!yourObject__c.PickList2__c}"/>

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.


Chamil's Blog


Ankit AroraAnkit Arora

Not sure if you are talking about visualforce page or native page. If you want dependency on visualforce page then Shashikant has given a very good link. If you are talking about native page then :


Just click on field dependencies in your object > Click New > Select "Controlling Field" - General Expense > Select Dependent Field - Your_Child_Picklist > Continue > Double Click on the values Under the General Expense Field which you want to show > Preview to make sure everything is fine > Save.


Now refresh your native page and check this is default provided by salesforce.



Ankit Arora

Blog | Facebook | Blog Page

Mack DsozaMack Dsoza

Hiiiii Thnx for the quick response,

But still have one problem that whatever the values in second picklist should be shown as command link not in picklist again...

Means whenever I select any value from picklist1 then appropriate value in picklist2 should be visible in the form of command link or directly text format...

So how to do that...

Shashikant SharmaShashikant Sharma

If you are using older version of API in VFP then,  Change the version of your page inversion settings to the latest 22.0 and try then. If you can see dependent picklist working then we will move to show command links.

Bhola VishwakarmaBhola Vishwakarma

Hiiiii, Shashikant,

can you tell me that what the things need to be change in above code that has posted by chamil.

But I need that the entire value of the picklist should be printed in column format & every value of picklist u can show me either commandlink or as text too...

I tried this thing by replacing 

<apex:inputField value=......>  with

<apex:outputText value=......>

& also tell me that how can I change api version from 21.0 to 22.0.