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
WikWik 

Including the dialog for Record Types while creating Lead records in the VF page

Hi,

Below is a piece of vf page, how do i include the various record types whilecreating a new lead record

<apex:page standardcontroller="Lead" tabstyle="Lead">
 
 <apex:form >
 
 <apex:sectionheader title="Lead Edit" subtitle="{!if(Lead.Id==null,'New Lead',Lead.Name)}"></apex:sectionheader>
 
 <apex:pageblock mode="edit" id="leadPB" title="Lead Edit">
 
 <apex:pageblockbuttons >
 <apex:commandbutton action="{!save}" value="Save"></apex:commandbutton>
 <!-- If you wish to implement Save & New functionality you will have to write an Apex Extension with your own Save & New Method -->
 <apex:commandbutton action="{!cancel}" value="Cancel"></apex:commandbutton>
 </apex:pageblockbuttons>
 
 <apex:pagemessages ></apex:pagemessages> <!-- displays all message generated by the component -->
 
 <apex:pageblocksection id="LeadInformationPBS" title="Lead Information">
 <!-- Make Owner field editable in system or else you won't be able to edit the Owner -->
 <apex:inputfield value="{!Lead.OwnerId}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Phone}"></apex:inputfield>
 
 <!-- Since we need to group two input fields together we need a pageBlockSectionItem with an Output panel.  We also needed to create a label so we know what field we are entering in -->
 <apex:pageblocksectionitem >
 <apex:outputlabel value="{!$ObjectType.Lead.Fields.FirstName.label}"></apex:outputlabel>
 <apex:outputpanel >
 <apex:inputfield value="{!Lead.Salutation}"></apex:inputfield>
 <apex:inputfield value="{!Lead.FirstName}"></apex:inputfield>
 </apex:outputpanel>
 </apex:pageblocksectionitem>
 <apex:inputfield value="{!Lead.MobilePhone}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.LastName}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Fax}"></apex:inputfield>
 
 <apex:inputField value="{!Lead.Company}" />
 <apex:inputfield value="{!Lead.Email}" required="true"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Title}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Leadsource}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Status}"></apex:inputfield>
 
 <!-- <apex:inputField value="{!Lead.Campaign}" />
 Campaign field is not able to be used unless you write your own custom class/method to create a campaign member
 Post explaining this issue: http://boards.developerforce.com/t5/Apex-Code-Development/Cannot-Access-to-Campaign-Field-from-Lead-Object/td-p/161715
 -->
 <apex:inputfield value="{!Lead.Rating}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Industry}"></apex:inputfield>
 <apex:inputfield value="{!Lead.NumberOfEmployees}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AddressInformationPBS" title="Address Information">
 <apex:inputfield value="{!Lead.Street}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.City}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.State}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.PostalCode}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.Country}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext> <!-- Don't Really need to implement this extra space, but it's not bad practice -->
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AdditionalInformationPBS" title="Additional Information">
 <apex:inputfield value="{!Lead.ProductInterest__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.CurrentGenerators__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.SICCode__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Primary__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.NumberofLocations__c}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="DescriptionInformationPBS" title="DescriptionInformation">
 <apex:inputfield value="{!Lead.Description}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="OptionPBS" title="Lead Information">
 <!-- If you want to have a checkbox to implement whether to use Active Assignment rules you will need to create your own using a custom Apex Extension and method -->
 Here we can place any extra fields or lead options we wish...
 </apex:pageblocksection>
 
 </apex:pageblock>
 
 </apex:form>
 
</apex:page>

Jigar.LakhaniJigar.Lakhani
You have to write code for that in separate apex class which will be used for your page as extension. Record type is not supported for input field.
Neet to use custom picklist for record type, you can retreieve dynamic record type names and display it using picklist.

http://www.interactiveties.com/b_visualforce_picklist.php#.VHXAaWNWiPp

Thanks ans Cheers,
Jigar