+ Start a Discussion
Raj R.Raj R. 

How to use @future with a schedulable class?


I currently have a schedulable class that is scheduled to run on a nightly basis. However, it will be using SOQL queries that can return more than 50,000 records. I was thinking of using the '@future' call, but was not sure if it works as my test results have been inconclusive. here is what I am trying to do and wanted to know if it will be able to process more than 50,000 if it comes to it

public class Test implements Schedulable(SchedulableContext sc){

public function() {
//some operations which may return greater than 50,000 records
List<Contact> newCnt = [Select Id From Contact]

}//end class

Best Answer chosen by Raj R.
if you have many records to process then go for batch apex class. The batch apex can then be scheduled to run using schedulable class. You can have alook at this , http://www.forcexplore.com/2014/04/what-is-batch-apex-class.html