You need to sign in to do that
Don't have an account?
Patricia Boyce 6
The example in Trailhead Using Standard List Controller doesn't work
It's the example in the Trail:
<apex:page standardController="Contact" recordSetVar="contacts">
02 <apex:pageBlock title="Contacts List">
03
04 <!-- Contacts List -->
05 <apex:pageBlockTable value="{! contacts }" var="ct">
06 <apex:column value="{! ct.FirstName }"/>
07 <apex:column value="{! ct.LastName }"/>
08 <apex:column value="{! ct.Email }"/>
09 <apex:column value="{! ct.Account.Name }"/>
10 </apex:pageBlockTable>
11
12 </apex:pageBlock>
13</apex:page>
First I entered it all by hand and it goes to a page with the title but no columns nor data. So I just copied their example and pasted it, still no data on the page, nor headlines, columns, etc.
What is missing?
Thanks
<apex:page standardController="Contact" recordSetVar="contacts">
02 <apex:pageBlock title="Contacts List">
03
04 <!-- Contacts List -->
05 <apex:pageBlockTable value="{! contacts }" var="ct">
06 <apex:column value="{! ct.FirstName }"/>
07 <apex:column value="{! ct.LastName }"/>
08 <apex:column value="{! ct.Email }"/>
09 <apex:column value="{! ct.Account.Name }"/>
10 </apex:pageBlockTable>
11
12 </apex:pageBlock>
13</apex:page>
First I entered it all by hand and it goes to a page with the title but no columns nor data. So I just copied their example and pasted it, still no data on the page, nor headlines, columns, etc.
What is missing?
Thanks
Try this :
Controller:
Page:
Thanks
Visualforce Error
Help for this Page
Invalid selectOptions found. Use SelectOption type in Apex.
This is really puzzling. If my code is right (copied from their example, does that mean there is a problem in my org?
1. Click on set up
2. Left Section Quick Search Box (Type : Visualforce Page)
3. Click on link Visual force page.
4. Now find your page now in available list of pages.
5. Open that page and click Preview button.
Your Url should be
YourORG_URL/apex/ContactList
Your code look good and working for me also Just copy paste same code and save. Then click on Preview button Like below screen shot.
Output will be like below :-
Let us know if this will help you
Thanks
Amit Chaudhary
I read above that maybe a custom contact could be causing an issue. how would I identify that?
--Tim
I got the same issue, but changing few keywords giving me a bit of change like getting field names. I try almost everything of my knowledge so far and get changes from my first screen shot to second.
Screenshot2:
I use the same code for different sObject like account and it works. It must be some issue with retrieving Contact records. Thank you all...!
I've figured out the issue. The code is correct provided by trailhead.
You will need to open 2 tabs.
First tab will be at your original contacts screen.
Second tab will be your visualforce page (contactlist)
On the first tab, toggle the view to "All Contacts". Once done, switch to your second tab, refresh the page. You will see all your contacts populated by the visualforce page that you created.
I think, this behavior is cos the default view taken by the Preview page doesn’t not have any record to show (may New Last Week/New This Week).
When we change the view to All Records in another tab and refresh the Preview page we can see the Records!
It can be verified by switching different views and refreshing the Preview page, the record count changing accordingly!!!