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
Patricia LimPatricia Lim 

Trailhead challenge - Create and use custom controllers

Hi all. I am trying to complete the custom controller trailhead and the following code samples are returning these errors:

- VF page - Unknown property: 'ContactsListController.contacts'
- Apex class - Unexpected token 'String'.

VF page
 
<apex:page controller="ContactsListController">
    <apex:form>
    	<apex:pageBlock title="Contacts List" id="contacts_list">
		<!-- Contacts List -->
		<apex:pageBlockTable value="{! contacts }" var="ct">
            <apex:column value="{! ct.FirstName }"/>
            <apex:column value="{! ct.LastName }"/>
            <apex:column value="{! ct.Title }"/>
            <apex:column value="{! ct.Email }"/>
        </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Custom Apex Controller
 
private String sortOrder = 'LastName';
public List<Contact> getContacts() {
    List<Contact> results = Database.query(
        'SELECT Id, FirstName, LastName, Title, Email ' +
        'FROM Contact ' +
        'ORDER BY ' + sortOrder + ' ASC ' +
        'LIMIT 10'
    );
    return results;
}

Thanks community! Learning as I go here
VinayVinay (Salesforce Developers) 
Hi,

We have separate Trailhead team who can help you with these issues.So,can you please use the below link to reach out to them so that one of the agent will get in touch with you.

Support:https://trailhead.salesforce.com/help

Thank you!

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks,
Vinay Kumar