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
Ravindra Kashyap 2Ravindra Kashyap 2 

Where I'll call  system.schedule method??

Hello Experts,

I want to run my apex code everyday on 1 PM, my question is where i should write below code for that??
Do I need to run in anonymous window??

proschedule p = new proschedule(); 
 String sch = '0 0 13  *  *  *'; 
 system.schedule('One Time Pro', sch, p);
Best Answer chosen by Ravindra Kashyap 2
Waqar Hussain SFWaqar Hussain SF
You can also schedule a class using the user interface.
  1. From Setup, enter Apex in the Quick Find box, then select Apex Classes.
  2. Click Schedule Apex.
  3. For the job name.
  4. Click the lookup button next to Apex class and enter * for the search term to get a list of all classes that can be scheduled. In the search results, click the name of your scheduled class.
  5. Select Weekly or Monthly for the frequency and set the frequency desired.
  6. Select the start and end dates, and a preferred start time.
  7. Click Save.

All Answers

Raj VakatiRaj Vakati
Yes .. Run from the execute anonymous window 
Waqar Hussain SFWaqar Hussain SF
You can also schedule a class using the user interface.
  1. From Setup, enter Apex in the Quick Find box, then select Apex Classes.
  2. Click Schedule Apex.
  3. For the job name.
  4. Click the lookup button next to Apex class and enter * for the search term to get a list of all classes that can be scheduled. In the search results, click the name of your scheduled class.
  5. Select Weekly or Monthly for the frequency and set the frequency desired.
  6. Select the start and end dates, and a preferred start time.
  7. Click Save.
This was selected as the best answer
GauravGargGauravGarg
Hi Ravindra,

Run it using developer console:
  1. Open developer console
  2. Click on Debug --> anonymous window
  3. write above code and run.
Thanks,
Gaurav