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
KeithlarsKeithlars 

Simple Visualforce page doesn't display data

I've followed the Chapter 9: Visualforce Pages and Data Sets example (p279) in Developer Guide, Advanced Programming Techniques for Cloud Computing and I'm trying to display contacts instead of Job Applicants in code below:

<apex:page standardController="Contact"
    recordSetVar="Contacts" tabstyle="Contact">
        <apex:pageBlock id="thePageBlock">
             <apex:pageblocktable value="{!Contact}" var="AC" id="acTable">
                <apex:column value="{!AC.firstName}"/>
                <apex:column value="{!AC.Department}"/>
                <apex:column value="{!AC.Title}"/>
                <apex:column headerValue="Country" value="{!AC.MailingCountry}"/>
                <apex:column value="{!AC.Account}"/>
            </apex:pageblocktable>
        </apex:pageBlock>
</apex:page>

However, no records are being displayed.  I've completed the example which show me the record set so I know there is data, its just not being displayed.   I strip out all that extra code to make it simple for debugging.  Anyone know what I'm doing wrong?
Ron HessRon Hess
looks like a typo, changed one or two things to make it work


Code:
<apex:page standardController="Contact"
    recordSetVar="myContacts" tabstyle="Contact">
        <apex:pageBlock id="thePageBlock">
             <apex:pageblocktable value="{!myContacts}" var="AC" id="acTable">
                <apex:column value="{!AC.firstName}"/>
                <apex:column value="{!AC.Department}"/>
                <apex:column value="{!AC.Title}"/>
                <apex:column headerValue="Country" value="{!AC.MailingCountry}"/>
                <apex:column value="{!AC.accountid}"/>
            </apex:Pageblocktable>
        </apex:pageBlock>
</apex:page>

 
changed contacts to myContacts and put that into the value of the pageblock table
changed ac.account to ac.accountid
KeithlarsKeithlars
Thanks Ron.  How would I have know to use mycontacts?  Where did this come from and what would I use for all contacts?  In the full code block I'm using the list filters and I have a filter for all contacts, but only the contact I own are appearing.

Keith
Ron HessRon Hess
myContacts is the name of the var specified in the apex : page attribute "recordsetVar"

in your case you declared Contacts, and used Contact

so i wanted to make it clear that these line up , and changed both.

see the docs for standard set controller

the contacts visible are controlled by sharing, perhaps you have a sharing rule ?

check that filter also, the label may say all contacts but the filters may specify my Contacts, it's happened to me before.