You need to sign in to do that
Don't have an account?
Lakshman
How to write an Apex schedulable interface for 10000+ records and write test class for the same?
Hi all,
I want to write a schedulable interface which updates mass records for accounts. The code which is written for this is as below.....
global class ScheduleAccountUpdate implements Schedulable{
global void execute(SchedulableContext ctx) {
List<Account> acc = [SELECT today__c from Account WHERE CloseDate__c AND today__c = false];
for (Account a : acc) {
a.Closed_date__c = true;
}
update acc;
}
}
-I want to ask that if my number of records are more than 10000 then will there be any problem and also whats the limit for, FOR loop. If my List exceeds 10000 the for loop should work. I had 9000+ records and it was taking some time for do schedulable job.
-Also How will i write a test class for above code.
Any help on this will be greatly appreciated.
Thanks in advance,
NightFox
use the batch interface to update those records, you can then schedule that batch job.
Thanks for your reply regger.
Do you have any example for such scenario. If yes can you please give along with test case.
I dint find any example for my case.
Thank you.
NightFox
Make a call to the batch as followed....
for the test method you can follow the below link......
http://mattreyuk2.wordpress.com/2010/08/21/testing-batch-apex/
If this gives u solution, mark it as a solution...