You’re now ready to write getMyAccounts(), which simply returns the list of 10 accounts most recently modified.
- Click the MyController tab.
- Modify the getMyAccounts() method to read as follows:
public List<Account> getMyAccounts() { return [SELECT Id, Name, AccountNumber FROM Account ORDER BY LastModifiedDate DESC LIMIT 10]; }
- Click Save.
Your page now displays the names of the 10 most recently modified accounts. The Visualforce expression {! myaccounts} causes Visualforce to execute yourgetMyAccounts() method in the MyController class. That method returns a list of account records, which is what the <apex:dataList> component iterates over.
No comments:
Post a Comment