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
Salesforce_NikitaSalesforce_Nikita 

Quick Start: Lightning Components

I am unable to view the results on Preview.
The list of contacts is not  being diaplyed
Abhishek BansalAbhishek Bansal

Hi Nikita,

I am not sure about your requirement as you have not mentioned it in more detail but as per my understanding you are missing the Id in the URL for which you want to see the records.
It would be goood and easy to help you out if you can explain your requirement in more detail and also provide the code of your VF page and controller class.

Thanks,
Abhishek Bansal.

Salesforce_NikitaSalesforce_Nikita
Hi,

I am using Lightning component to display list of contacts (Following the Quick Start: Lightning Components trailhead).
The list of contacts is not being diaplyed when the component is previewed.
Abhishek BansalAbhishek Bansal

Hi Nikita,

Have you created the Contact records in your org.
If yes than i am not sure what is wrong here.

If you want more help than please contact me on gmail or skype :
Gmail : abhibansal2790@gmail.com
Skype : abhishek.bansal2790

Thanks,
Abhishek

Charles ThompsonCharles Thompson

I found this issue also.  Completed all the steps of Quick Start: Lightning Components in Trailhead, and didn't get any results in the new component.  For anyone who comes after me, the resolution is to edit the Apex controller to look like the following:

File: MyContactListController.apxc
 

public class MyContactListController {
    @AuraEnabled
    public static List<Contact> getContacts(Id recordId) {
        List<Contact> cs = [SELECT Id, 
                			       FirstName, 
			               		   LastName, 
			               		   Email, 
			               		   Phone 
			                FROM   Contact 
			                WHERE  AccountId = :recordId
            			   ];
        return cs;
    }
}

See what I did here?  The original code just returns the SOQL result without storing it in a List variable.  The correct (standard) practice is to declare a local variable, SELECT into the variable, then return the variable.

This should now work for you.