I'm wondering if this is possible to do. I have a VF page embedded on a standard page layout that creates quick sales objects. Now the page displays all values for 4 dependent picklists but I'd like to able to do this:

Page layout 1 has the page embedded with all 6 picklist values shown.

Page layout 2 wants to have the page embedded with only 3 of 6 picklist values available

Is it possible for me to hide certain picklist values based on the record type of the record the VF page is on? I'm not sure if this is even possible, since you cannot have URL parameters on a page when you embed it on a standard page layout. I've checked out various JS/JQuery hacks to conditionally hide the picklist values but that's probably a no go since it's not guaranteed to be cross-browser compatible.


Try using a custom selectoption list instead of your standard picklist field. Something like this should do the trick.

public String selectedValue  {get; set;}
public String RecordTypeName {get; set;} // populate this through your standardcontroller

public List<SelectOption> getMyPicklist()
    List<SelectOption> options = new List<SelectOption>();      

    Schema.DescribeFieldResult fieldResult = MyObject__c.Picklist__c.getDescribe();
    List<Schema.PicklistEntry> picklistEntries = fieldResult.getPicklistValues();

    // Add the picklist values that you want to the field based on RecordType
    for(Schema.PicklistEntry entry : picklistEntries)
        if(RecordTypeName == 'TheOneWithRestrictions' && entry.getLabel() != 'Option1' && entry.getLabel() != 'Option2' && entry.getLabel() != 'Option3')
            options.add(new SelectOption(entry.getValue(), entry.getLabel()));
        // this is the recordtype without restrictions so just add all values.
            options.add(new SelectOption(entry.getValue(), entry.getLabel()));

    return options;

on the visualforce page use a selectlist instead

<apex:selectList value="{!selectedValue}" size="1" multiselect="false">
    <apex:selectOptions value="{!MyPicklist}"/>

Then in your save method for your other object assign the selectedValue string to the picklist field.


You can hide specific picklist values for the specific record types. For that go to the custom object page and click on the Record Type you want to change. In the Picklists Available for Editingsection you will find all picklists that assotiated with this recird type. Click on the Edit link to edit the picklist values. There are two lists: Available Values and Selected Values. Only selected values are visible on the page layout.

  • That's actually not an option since the the page is on a layout for Sales Object A, but it creates records of Sales Object B. The requirements are that a certain group of users using the page only see a certain subset of the picklist values in question.
    – akarnid
    Oct 8 '13 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.