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
Leo_LawLeo_Law 

Unable to display all record name of Account in a column with VF

Hi All,

 

i want to display all the Account Name of all record in a VF page with follow code:

 

<apex:pagestandardController="Account" tabStyle="Account">

  <apex:sectionHeader title="test"/>

  <apex:form>

      <apex:pageBlock>

          <apex:pageBlockSectiontitle="Account zum Vergleichen"columns="2"collapsible="false">

               <apex:pageBlockTable title="Account Infor" value="{!account}" var="a">

                       <apex:column value="{!a.name}" />

          </apex:pageBlockSection>

     </apex:pageBlock>

   </apex:form>

</apex:page>

 

In the SF page it doesn't display the Account Name of all account record, it display only the titel.

if i navigate to an Account detail page with e.g.:https://na3.salesforce.com/001D000000IRt53, it displays only the Account name with this ID(001D000000IRt53).

 

But if i use the simmilar Code for a custom object, all records of the custom object will be displayed.

 

Can anyone please help me explain the code.

Thanks in Advance

Leo

Starz26Starz26

Qick example from the docs related to the <apex:page> tag

 

<apex:page standardcontroller="Account" recordSetVar="accounts">
<apex:pageblock>
<apex:pageBlockTable value="{!accounts}" var="a" >
<apex:column value="{!a.name}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:page>

 

Leo_LawLeo_Law

HI,

 

I tested the Code, it doesn't work with

 

standardController ="Account" .

<apex:pagestandardController="Account" recordSetVar="accounts1">

     <apex:sectionHeadertitle="Update the Data of Account"/>

     <apex:pageblock>

            <apex:pageBlockTablevalue="{!accounts1}"var="a">

                 <apex:columnvalue="{!a.name}"/>

            </apex:pageBlockTable></apex:pageblock>

</apex:page>

 

no Account Name was displayed in VF page. only the headertitel "Update the Data of Account" was displayed.

 

 

if i use a  custom Object as standardController ="HHH__c" , The record name will be displayed in VF page.

 

Does it only work with custom Object?

Starz26Starz26
Try starting exactly with the code I provided, it works fine with accounts and any other object.

Then make modifications one at a time and test to ensure you did not break it.

I am not sure with your code as it should not even save since there is no spacing between the critical elements and you have an extra line before the <apex:page

Leo_LawLeo_Law

i created some new Accounts record, the new Accounts record are all displayed!!! it is wondeful.

 

But the old accounts that befor the new Account created,can't be displayed  with the supplyed Code. It's curious that they aren't be displayed in VF Page.