+ Start a Discussion
Preetham ThummalaPreetham Thummala 

schedule apex

Can we manually schedule the apex class?
Amit Chaudhary 8Amit Chaudhary 8
Please try below example:-

Example 1:-
DateTime currentDateTime=System.now().addMinutes(1);                            
        String nextScheduleTime=String.valueof(currentDateTime.second()) +' '+String.valueof(currentDateTime.minute())+' '
                                +String.valueof(currentDateTime.hour())+' '+String.valueof(currentDateTime.day())+' '
                                +String.valueof(currentDateTime.month())+' ? '+String.valueof(currentDateTime.Year());
        TestSchedulableClass testObj = new TestSchedulableClass();
        system.schedule('Scheduled JOB', nextScheduleTime, testObj);

Example 2:- 
String chron1 = '0 1 * * * ? *';      
System.schedule('Every 1 min', chron1, new JOBNAME());

Please let us know if this will help you.

Amit Chaudhary
Vivek DeshmaneVivek Deshmane
Please check below step.
Setup -> Develop -> Classes

You will see a "Schedule Apex" button. You can set up the timing from there.


Best Regards,