Database.getUpdated() using Visualforce and Apex in Salesforce

Visualforce Page:
<apex:page controller="DatabaseGetUpdatedController">
<apex:pageBlock>
<apex:pageBlockTable value="{!listAccounts}" var="acc">
<apex:column headerValue="Name">{!acc.Name}</apex:column>
<apex:column headerValue="Industry">{!acc.Industry}</apex:column>
<apex:column headerValue="Type">{!acc.Type}</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Apex Class:
public class DatabaseGetUpdatedController {

public List < Account > listAccounts { get; set; }

public DatabaseGetUpdatedController() {

Database.GetUpdatedResult r = Database.getUpdated(
'Account',
Datetime.now().addDays( -20 ),
Datetime.now()
);
listAccounts = [
SELECT Id, Name, Industry, Type
FROM Account
WHERE Id IN: r.getIds()
];

}

}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store