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
Puneeth KumarPuneeth Kumar 

Standard list controller in trailhead module

Hello Everyone,

I'm currently having issue in standard list controller module where I'm unable to see list of contacts in the preview section. I've used the code given in module. Even though I have so many contacts in my salesforce org. Can anyone please help me out.Here is the code which I've used. 
Not even able to see single contact. User-added image
Pramodh KumarPramodh Kumar
You may be missing something but it should work. here is my code for that scenario
<apex:page standardController="Contact" recordSetVar="cont">
    <apex:pageBlock title="Contacts List">
        
        <!-- Contacts List -->
        <apex:pageBlockTable value="{!cont}" var="ct">
            <apex:column value="{!ct.FirstName}"/>
            <apex:column value="{!ct.LastName}"/>
            <apex:column value="{!ct.Email }"/>
            <apex:column value="{!ct.Account.Name}"/>
        </apex:pageBlockTable>
        
    </apex:pageBlock>
</apex:page>

Thanks,
pRAMODH
Puneeth KumarPuneeth Kumar
Thanks Pramod, but I'm not able to figure out what's wrong. Here is my code. Everything is same as in module. Do I have to deal something with the apex:column values ? I doubt that. Cause I have only Name in contact object. 

<apex:page standardController="Contact" recordSetVar="contacts">
    <apex:pageBlock title="Contacts List">
        
        <!-- Contacts List -->
        <apex:pageBlockTable value="{! contacts }" var="ct">
            <apex:column value="{! ct.FristName }"/>
             <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Email }"/>
            <apex:column value="{! ct.Account.Name }"/> 
        </apex:pageBlockTable>        
        
    </apex:pageBlock>
</apex:page>
Amit Chaudhary 8Amit Chaudhary 8
Hi Puneeth,

Your code look good to me. Can you please check your org have contacts records ? Also check OWD that contact are visible to you.

 
Jonathan Meltzer 14Jonathan Meltzer 14
I am having this same problem.  I copy/paste the code from the lesson into the Dev Console, and I do not see any contacts.  My org has contacts, and I can see them when I search the org, but I cannot see them in the preview of this VF page.  Any ideas?
Jonathan Meltzer 14Jonathan Meltzer 14
Further down in the challenge, when you add in the List View Filters, suddenly it works.  
Puneeth KumarPuneeth Kumar
Hi Amit, I've checked for contact records which I got. Even checked the OWD of contact object which is controlled by parents. Do I need to change it to public read/write ? 

Yes Jonathan, I doubt on the dynamic expressions of <apex: column value={!.....}>  or might be standard controller which is not getting the right object to work. I'll let you know if I get through it.

Thank you.
Pramodh KumarPramodh Kumar
Go to the contacts tab, select "All Contacts" from the dropdown. then open the visualforce page.


Thanks,User-added image
Pramodh.
Puneeth KumarPuneeth Kumar
Yeah me too experinced the same after adding up filters Jonathan. May be its designed that way and hope its same for everyone.
Yes Pramod, I can see contacts if I add filters option. Untill then all recordsare invisible. Is it same for you too?

Thank you.
 
Amit Chaudhary 8Amit Chaudhary 8
If issue is remain same feel free to connect with me on my email id "amit.salesforce21@gmail.com" i can have a lookinto your org