8 réponses
Hi Learn sfdc 24,Spring '16 release notes (http://docs.releasenotes.salesforce.com/en-us/spring16/release-notes/rn_apex_new_classes_methods.htm⌗rn_apex_new_classes_methods_changed_classes) document a new system method supporting this:Steps :Just create a new DateTime objectuse Test.setCreatedDate to set the dateTime for the createdDate of that objectUse the below sample code :
Let me know if it helps.Thanks and Regards,Shiva RVAccount account = new Account(Name = 'Test'); insert account;
Datetime yesterday = Datetime.now().addDays(-1);
Test.setCreatedDate(account.Id, yesterday);