I'm getting this error:
Method does not exist or incorrect signature: void setCreatedDate(List<Object__c>, Datetime)
With this (excerpt of) test class below
List<Object__c> testRecords = new List<Object__c>();
for (Integer i = 0; i < 5000; i++) {
testRecords.add(new Object__c(Name = 'Test Record ' + i));
DateTime TestCreatedDate = DateTime.now().addDays(-15);
Test.setCreatedDate(testRecords, TestCreatedDate);
}
insert testRecords;
No problem doing it with a single record Id, but no idea how to do it with a list. This is to test a class that deletes records more than 14 days old (which is working). The test class saves if I remove the Test.setCreatedDate()
method, but then the test doesn't pass.
I've omitted the entire class for the sake of not having to redact a bunch of org specific information, but if it's a necessity then I'll begrudgingly amend it for public consumption...