function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
santhosh konathala 8santhosh konathala 8 

How to run schedule apex from developer console

Vijay NagarathinamVijay Nagarathinam
Developer console -->Debug -->Open execute anonymous window 

In that window create a object of your Schdule Apex class then call excute() method passing as null like below

YourScheduleApexClass s=new YourScheduleApexClass();
s.excute() ;


Thanks,
Vijay
Vijay NagarathinamVijay Nagarathinam
Use the below code in your developer console, anonymous window,
 
SchedularForBatchApexSFBA = new SchedularForBatchApex ();String sch = ‘0 0 24 31 12 ?';system.schedule(‘Execute Schedular’, sch, BWE);

Thanks,
Vijay
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for Batch job and Scheduler class. I hope that will help you
1) http://amitsalesforce.blogspot.in/2016/02/batch-apex-in-salesforce-test-class-for.html

How to Schedule scheduler class
There are two option we have schedule the scheduler classes.
1) By System Scheduler.
2) By Developer console

System Scheduler.

Step 1) Click on Setup->Apex class. Then search Schedule Apex button.
Step 2) Select the scheduler class and set Time


By Developer console 

Execute below code from developer console :-

AccountUpdateBatchJobscheduled m = new AccountUpdateBatchJobscheduled();
String sch = '20 30 8 10 2 ?';
String jobID = system.schedule('Merge Job', sch, m);

Let us know if this will help you

Thanks
AMit Chaudhary

 
Prasan6Prasan6
Hi Amit/Vijay, 

What does sch mean? 

Can you please explain why you have those respective values? 

Thanks,
 
Wade Lovell 84Wade Lovell 84
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year

'sch' is just the variable name being assigned to schedule in the code above

You can learn more at:
https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_scheduled

and

https://developer.salesforce.com/docs/atlas.en-us.224.0.apexcode.meta/apexcode/apex_scheduler.htm
Suraj Tripathi 47Suraj Tripathi 47

Hi Santhosh,

You can run using an anonymous window. You can take reference from the below syntax.
ClassName name1= new ClassName (); 
String cronExp= '0 0 * * * ?';
System.schedule('Scheduled', cronExp, name1);

If you find your Solution then mark this as the best answer. 

Thank you!

Regards 
Suraj Tripathi