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

Inserting account field in visual force page having Person Accounts Record types
Error message while updating Person Account through visual force wizard
herei s my code
<apex:page controller="patientController" tabStyle="Opportunity" sidebar="false" showHeader="false">
<apex:form >
<apex:pageBlock title="Record Type">
<apex:pageMessages />
<apex:pageblocksection >
<apex:panelGrid >
<apex:outputLabel value="Record Type" for="recordtype"/>
<apex:inputField id="recordtype" value="{!PersonAccount.RecordTypeId}"/>
</apex:panelGrid>
</apex:pageblocksection>
<apex:pageBlockSection title="Contact Information">
<apex:panelGrid columns="2">
<apex:outputLabel value="Name" for="perfirstName"/>
<apex:inputField id="perfirstName" value="{!PersonAccount.Name}"/>
</apex:panelGrid>
</apex:pageBlockSection>
<apex:facet name="footer">
<apex:outputPanel >
<apex:commandButton action="{!step1}" value="Next" styleClass="btn"/>
</apex:outputPanel>
</apex:facet>
</apex:pageBlock>
</apex:form>
</apex:page>
Class.patientController.save: line 70, column 1
while inserting the Person account error is
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Account: bad field names on insert/update call: Name: [Name]
Any one please need a suggestion
public PageReference save() {
PersonAccount.RecordTypeId=PersonAccount.RecordTypeId;
insert PersonAccount;
PageReference orderPage = new PageReference('/' +PersonAccount.id);
orderPage.setRedirect(true);
return orderPage;
}
Thanks In advance,
Newbie @ knight12
With person Account you should be inserting values for firstname and last name,then only you can perform insert operation for any record.