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
AlanisticAlanistic 

Visualforce page to display the latest record info

Hi have a new custom object called webinar__c.  I have a page that has a list of record names.

On my visualforce page, how can I display only the newest record for the webinar__c object?  The field names would be webinar__c.Name and webinar__c.Description__c   

This will give me a list of all of the previous entries and also a upcoming session.
Best Answer chosen by Alanistic
ShashankShashank (Salesforce Developers) 
Hi,

You can write a controller extension for your VF page which includes a SOQL query that sorts by created date and limits by 1.

Something like this:
SELECT Name, Description__c, CreatedDate FROM Webinar__c ORDER BY CreatedDate DESC LIMIT 1

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank