I am overriding person account standard Page with VF page. If I use standard controller as "Account" I am unable to get Picklist field values from "Person Account", If I use "Contact" as a Standard Controller I will get all picklist field value but can not Override "New" button in standard "Account" object.

This is my visualforce Page

<apex:page standardController="Contact" extensions="Account_ext" tabStyle="account" sidebar="false" >
<apex:form >
 <apex:pageBlock title="Person Contact Edit">
   <apex:pageBlockButtons >
       <apex:commandButton value="Save" action="{!save}"/>
       <apex:commandButton value="Cancel" action="{!cancel}"/>
       <apex:commandButton value="Save & New" />

    <Apex:pageBlockSection >

     <apex:pageBlockSectionItem >
<apex:outputlabel value="First Name"/>
<apex:outputpanel >
    <apex:outputfield value="{!Contact.Salutation}" />
    <apex:outputfield value="{!Contact.FirstName}" />

       <apex:inputField value="{!Contact.lastname}"/>        
        <Apex:inputField value="{!Contact.Lead_Source__c}" />
        <apex:inputField value="{!Contact.Enquiry_Budget__c}"/>
         <apex:inputField value="{!Contact.Enquiry_check__c}"/>
        <apex:inputField value="{!Contact.Enquiry_Flat_Type__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Locality_Preference__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Location__c}"/>
          <apex:inputField value="{!Contact.Enquiry_Name__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Potential_Name__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Property_Type_Preference__c}"/>
         <apex:inputField value="{!Contact.Enquiry_Type_Of_Purchase__c}"/>
         <apex:inputField value="{!Contact.Lead_Source__c}"/>
       <apex:inputField value="{!Contact.Mailing_City__c}"/>
     <apex:inputField value="{!Contact.Mailing_Country__c}"/>
       <apex:inputField value="{!Contact.Mailing_State_Province__c}"/>
       <apex:inputField value="{!Contact.Mailing_Street__c}"/>
       <apex:inputField value="{!Contact.Mailing_Zip_Postal_Code__c}"/>  
       <apex:inputField value="{!Contact.Opportunities__c}"/>

      <apex:pageBlockSectionItem >
       <apex:outputLabel >Project</apex:outputLabel>
                    <apex:selectList multiselect="false" size="1" value="{!Contact.Project__c}">
                        <apex:selectOptions value="{!prj}" />



This is my Controller as of Now still work is on.....

public class Account_ext {

    public Account_ext(ApexPages.StandardController controller) {

     public string prj;

    List<selectOption> options = new List<selectOption>();
    public List<selectOption> getprj() {
        for(project__c acc : [select Id,name from project__c])
            options.add(new selectOption(acc.name,acc.name));
        return options;

  • Do you have an example of where it is not working using the Account standard controller? Your current code sample only shows using the Contacts standard controller. – Alex Tennant Feb 11 '14 at 15:38

You'll need to setup a dispatcher page that you will use in your New override. It should inspect the record type and then redirect to the right page. See this blog post on how to do that: http://blog.jeffdouglas.com/2008/11/14/redirecting-users-to-different-visualforce-pages/

| improve this answer | |
  • what about the standard controller whether it should be "Account" Or "Contact". If it is contact it saves record in contact, if account it won't fetch field values. – user40138 Feb 11 '14 at 15:20
  • I don't have too much experience with coding around person accounts, but I was thinking your dispatcher would use Account and then redirect the user to the page you posted in the question. Is that one not working? – Daniel Hoechst Feb 11 '14 at 15:42
  • i am working on that, i will let you know once done – user40138 Feb 11 '14 at 15:50

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.