+ Start a Discussion
giri rockzzzzgiri rockzzzz 

Can any one give sample example on schedule apex class???

Can any one give sample example on schedule apex class???


global class MyScheduledProcess implements Schedulable
global void execute(SchedulableContext ctx)
// TODO: your code here

global static void testSchedule()
MyScheduledProcess sched = new MyScheduledProcess();
Id job_id = System.schedule('test', '0 0 0 30 12 ? 2099', sched);
System.assertNotEquals(null, job_id);
// TODO: test your code



We use Apex Scheduler to schedule a controller to execute it at a given time in future. For this make an Apex Scheduler Controller and to schedule this controller go to...


Administration Setup->Monitoring->Scheduled Jobs from there we select that Controller class and then provide some time and date to execute it in future.

            Below is a sample code of the Apex Scheduler Controller to send an email :
            global class ApexScheduledClass Implements Schedulable
                       global void execute(SchedulableContext sc)
                        public void sendmail()
                                    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                                    string [] toaddress= New string[]{'vkumar.sri@gmail.com'};
                                    email.setSubject('Testing Apex Scheduler-Subject');
                                    email.setPlainTextBody('Testing Apex Scheduler-Body');
                                    Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});


hi Every Body . . .


  can any body tell me .... how can i schedule an extension class of Apex. When i schedule it gives me an error that ....

   "Constructor not Defined" 

   Thank u so much in advance.