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
gv007gv007 

Unknown property AccountStandardController.account

Error: core.apexpages.el.adapters.exceptions.UnknownPropertyException: Unknown property 'AccountStandardController.account'
Error
Error: Unknown property 'AccountStandardController.account'
 
I have a situation,i want  extended some of my standard controller property to my cusom controller ,when using my code i got following,here is my code anybody tell me ,where i did my mistake.
Code:
VF page:
<apex:page standardController="Account" extensions="myFirstController"  showHeader="true" tabStyle="Account">
<apex:pageBlock title="Accounts">
<apex:form >
<apex:dataTable value="{!accountList}"  var="account" cellpadding="4" border="1">
<apex:column >
<apex:commandLink >
<apex:outputText value="{!account.name}"/>
</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:form>
 </apex:pageBlock> 
 <apex:pageBlock title="Contacts">
 </apex:pageBlock>
  </apex:page>
Code:
public class myFirstController{ 
    public myFirstController(ApexPages.StandardController stdController){ }

 

 public Account[] getAccountList() {
  
           /*       return [select id,name from Account where id = :System.currentPageReference().getParameters().get('id') ];  */
           return [select id,name from Account limit 25]; 
                                 }    
            public String getName()
            
             { return 'My First Custom Controller';
             
             }
            
             }

 
Ron HessRon Hess
you have encountered an issue with using var="account"

you must use a different value for var, this particular value causes some overloading of the term

{!account.name}   is it the standar controller or the dataTable which will fill this in? and thus the error you see


this will work , notice i changed account ==> acc

Code:
<apex:page standardController="Account" extensions="myFirstController"  showHeader="true" tabStyle="Account">
<apex:pageBlock title="Accounts">
<apex:form >
<apex:dataTable value="{!accountList}"  var="acc" cellpadding="4" border="1">
<apex:column >
<apex:commandLink >
<apex:outputText value="{!acc.name}"/>
</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:form>
 </apex:pageBlock> 
 <apex:pageBlock title="Contacts">
 </apex:pageBlock>
  </apex:page>

 

gv007gv007
Thanks you very much Ron helping me.Here is my actuval problem
 
 I want to show a list of Accounts and when  click on an Account, a different part of the screen would refresh with all  of the avaiable Contacts in that Account. when clicking on particular contact name the related contact details page need to display.
 
 when am clicking on an account it is not displaying related contacts in contacts in contact block,where i did my mistake? it is only displaying the first accounts contacts ,after clicking another account it is not displaying the accounts related contacts in contact block.
 
here is my code:
Code:
<!-- <apex:page controller="myFirstController"  showHeader="true" tabStyle="Account"> -->
<apex:page standardController="Account" extensions="myFirstController"  showHeader="true" tabStyle="Account">
<apex:pageBlock title="Accounts">
<apex:form >
<apex:dataTable value="{!accountList}"  var="acc" cellpadding="4" border="1">
<apex:column >
<apex:commandLink>
<!--<apex:outputText value="{!acc.name}"/>-->
{!acc.name}
</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:form>
 </apex:pageBlock> 
 <apex:pageBlock title="Contacts">
  <apex:form >
        <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
            <apex:column >
                    <apex:commandLink rerender="detail" status="status">
                              {!contact.Name}
                     <apex:param name="cid" value="{!contact.id}"/>
                </apex:commandLink> 
                     </apex:column>
        </apex:dataTable>
    </apex:form> 
        </apex:pageBlock>
   
  <apex:outputPanel id="detail">
      <apex:actionStatus id="status" startText="Requesting..">
              <apex:facet name="stop">
                                 <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/>
               </apex:facet>
       </apex:actionStatus>
  </apex:outputPanel>
   </apex:page>

public class myFirstController{ 
    public myFirstController(ApexPages.StandardController controller) {

    }


    public myFirstController(){ }

 

 public Account[] getAccountList() {
  
            return [select id,name from Account limit 25]; 
                                 }    
            public String getName()
            
             { return 'My First Custom Controller';
             
             }
            
             }

 
softsquaresoftsquare

Ron,

I am working on a Visualforce page to display a list of Accounts and all relevant fields in each object.

Since Apex classes are not supported in SF Group edition, I have no way to create an Controller extension.

How would I make the following code to work? Why wouldn't the standard Account controller return a list of accounts that I can iterate using the dataList tag?

<apex:page standardController="Account" tabStyle="Account">
<apex:dataList value="{!accountList}" var="acc" id="theList">
<apex:outputText value="{!account}"/>
</apex:dataList>
</apex:page>

Andi Giri

dchasmandchasman
The set oriented capabilities in the standard controller you are looking for are part of the next major release of salesforce.com - currently you cannot do what you want without using apex code.
dev401hasdev401has

@gv007

 

Were you able to solve the problem then?

I am facing the same problem right now and in need of the solution.

dev401hasdev401has

I got it. its working fine nw.

Rohit Kumar MalikRohit Kumar Malik
I have following points to make on this:

<apex:page controller="ContactsListController" title="Contact List With Custom Controller">


This CustomController is associated with the getter Method. of the specific Object. So the method name of the controller class should be as follows:

-> getContacts
-> Use the correct access specifier for this method for eg. 
public static List<Contact> getContacts() {

once you define you controller and the getter method with above specification. You will not face any issue. 


Regards,
Rohit

 
Rohit Kumar MalikRohit Kumar Malik
Below is an additional code snippet which can add more clarity on this. 

1, the variable what we use to get the list of records from the controller should match the get + rest of method Name.

If getter Method name is 
 public static List<Contact> getMySpecificContacts() {
Then the variale name you should use is MySpecificContacts 
<apex:PageBlockTable value="{! MySpecificContacts}" var="ct">

 public static List<Contact> getContacts() {
Then the variale name you should use is MySpecificContacts 
<apex:PageBlockTable value="{! Contacts}" var="ct">


we can clearly see here that the variable name matches the getter method name.