I have a SObject called DDStatus__c which has LastUpdated__c field (DateTime type). How can I get latest datetime using SOQL query.
Tell me more
×
Salesforce Stack Exchange is a question and answer site for
Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
|
|
|||||
|
|
You should be able to do this query to get the record showing the latest datetime:
You can add a Where clause if this is a child object and you're looking for the latest datetime for a specific parent record. |
|||||||
|
|
Unless I'm missing something, this line should work, as long as you are certain the record you're querying for exists. If you aren't sure it exists, you should cast the query to a list, and look for the first element in the list to get the field value from.
|
|||
|
|