So I want to display all 'sites' from the Site custom object on a Visualforce page called Launchpad.

     <apex:pageBlockTable value="{!Site__c}" var="site">
          <apex:column value="{!site.Site_Name__c}"/>

I am using for the header of the VF page:

<apex:page showheader="false" sidebar="hidden" standardStylesheets="false" standardController="Site__c">

But I cannot seem to render anything. This is the API Name for the field I want to print: Site_Name__c and this is the object API Name: Site__c.

Thanks for your help in advance!

  • It seems that Site__c is a custom object. isn't it??then why you have used standardController="Site__c"? – Subhasis Kar Apr 20 '17 at 15:56
  • @SubhasisKar this is fine, Custom object can be applicable for standardController – Santanu Boral Apr 20 '17 at 15:57

You should use standardController with recordSetVar to list of all the sites.

<apex:page standardController="Site__c" recordSetVar="sites">
         <apex:pageBlockTable value="{!sites}" var="site">
              <apex:column value="{!site.Site_Name__c}"/>

For more information, Accessing Data with List Controllers

StandardController without recordSetVar will show only single record detail.

| improve this answer | |
  • Perfect! This worked for me. Although, final question, how would I display just the records without the field name? – KK1 Apr 20 '17 at 16:08
  • you can try to achieve your 2nd requirement and in case you face issues, please post that separately. – Santanu Boral Apr 20 '17 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.