You need to sign in to do that
Don't have an account?
When referencing account.name with inputField, you must select isPersonAccount in your SOQL query
I have been following the cookbook and would like to add fields to edit objects on my visual force page. I have used the following code:
<apex:pageBlockSectionItem > <apex:outputLabel value="Name"/> <apex:inputField value="{!account.name}"/> </apex:pageBlockSectionItem>
and the apex:
public Account getaccount() { return [select id, salutation, name from Account where id = :System.currentPageReference().getParameters().get('id')]; }
it brings up the error:
When referencing account.name with inputField, you must select isPersonAccount in your SOQL query
I have tried using SOQL that selects isPersonAccount = true but this doesn't seem to fix the proble, what is the error asking for?
Thanks
Pete
public Account getaccount() {
return [select id, salutation, name, isPersonAccount from Account where id =
:System.currentPageReference().getParameters().get('id')];
}
All Answers
public Account getaccount() {
return [select id, salutation, name, isPersonAccount from Account where id =
:System.currentPageReference().getParameters().get('id')];
}
Thanks Doug,
That fixed it. The reason I'm not using the standard controller is that I'm using a selection of objects from all over the shop on this page. I understand that if you are using a standard controller this limits your interaction with other objects.
thanks again!
Pete