You need to sign in to do that
Don't have an account?

How to get Person Account's “Last Name” , “salutation” and “First Name” field to Visualforce Page
In my org i have enabled Person Account, and i have a visualforce page where i need to get Salutation,FirstName and LastName field from person account, But when i call it using <apex:inputField value="{!account.lastname}"/> I'm getting only field label here i'm using "account" as a standard controller.
But I have used same line of code i.e <apex:inputField value="{!account.lastname}"/> to get contact's Lastname using "Contact" as standard controller
Here in the below code I'm getting only field label for "Salutation" and "Lastname" but I'm getting both label and field for "Account Name"
can anyone tell me what's problem here ?
<apex:page standardController="Account" extensions="pick_list" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputlabel value="First Name"/>
<apex:outputpanel >
<apex:inputfield value="{!account.Salutation}" />
<apex:inputfield value="{!account.FirstName}" />
</apex:outputpanel>
</apex:pageBlockSectionItem>
<apex:inputfield value="{!account.lastname}"
<apex:inputfield value="{!account.name}"
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
But I have used same line of code i.e <apex:inputField value="{!account.lastname}"/> to get contact's Lastname using "Contact" as standard controller
Here in the below code I'm getting only field label for "Salutation" and "Lastname" but I'm getting both label and field for "Account Name"
can anyone tell me what's problem here ?
<apex:page standardController="Account" extensions="pick_list" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputlabel value="First Name"/>
<apex:outputpanel >
<apex:inputfield value="{!account.Salutation}" />
<apex:inputfield value="{!account.FirstName}" />
</apex:outputpanel>
</apex:pageBlockSectionItem>
<apex:inputfield value="{!account.lastname}"
<apex:inputfield value="{!account.name}"
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Your problem is because for person accounts the firstName, lastName, and Salutation (among other fields) are stored in a contact record that is related to the account record. You can use account.PersonContactId to fetch the contact related to that person account to display salutation and last name. You can also use the account.IsPersonAccount to determine if the account is a person account or not and hide/show this fields as needed.
Hope this helps!