Database.getUpdated using Apex in Salesforce

Syntax:
Database.GetUpdatedResult r = Database.getUpdated(
    'Object API Name',
    StartDateTime,
    EndDateTime
);

Sample Code:
Database.GetUpdatedResult r = Database.getUpdated(
    'Account',
    Datetime.now().addDays( -1 ),
    Datetime.now()
);
System.debug( 'Updated Records result is ' + r );

To get Ids:
Database.GetUpdatedResult r = Database.getUpdated(
    'Account',
    Datetime.now().addDays( -1 ),
    Datetime.now()
);
System.debug( 'Updated Accounts Ids are ' + r.getIds() );

No comments:

Post a Comment