I am trying to create a new Opportunity from an existing Case using a custom button. I am able to pass in various parameters but I would like to also filter the Record Types on the initial selection screen. Is this possible by adding extra parameters to the URL?

  • You can of course assign a specific record type with an URL parameter, but if you want to give the user a choice of record types, then a custom VF page plus controller is the only way to go.
    – akarnid
    Nov 15, 2013 at 0:00

2 Answers 2


I agree with @sfdcfox. VF is the way to go if you need to filter record Type options, no way to use page params in the native UI.

This is just a very simple example I drew up that could be used as a start .

In VF Page


    <apex:selectList value="{!recTypeID}" size="1">
        <apex:selectOptions value="{!myOptions}"></apex:selectOptions>

    <apex:commandButton value="Next" Action="{!continue}"/>


In controller

    public class myController {

        private List<SelectOption> opts             {get;set;}
        private String oType                        {get;set;}
        public Id recTypeId                         {get;set;}

            //You could use something like this to make the page more dynamic if you pass in the sObjectType through a URL param
            //oType = system.currentPageReference().getParameters().get('oType');

            //Assuming you know the sObjectType, you can just set it here
            oType = 'Account';

        public List<SelectOption> getMyOptions() {
            opts = new List<SelectOption>();

            opts.add(new SelectOption('','--Please Select Record Type --'));

            list<RecordType> rts = [Select Id, Name From RecordType Where sObjectType =: oType]

                Perform some logic here to filter out the record types you dont want as an option from your list

            //For all remaining recordTypes in the list, add them as select options
            for(RecordType r : rts){
                opts.add(new SelectOption(r.id,r.name));
            return opts;

        public PageReference continue(){

            //If you used a page param to determine the object type, you will have to query for the sObject here, but this is assuming you know the sObject type
            Schema.DescribeSObjectResult res = Account.SObjectType.getDescribe();

            PageReference p = new PageReference('/' + res.getKeyPrefix() + '/e?RecordType=' + recTypeId);
            return p;

No. The user will automatically be given a choice of any record type available on their profile. You may want to consider a custom record type selection page (Visualforce) if you want to provide additional capability.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .