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
salesforce sfdxsalesforce sfdx 

Hi salesforce Team, i need to schedule a class in salesforce for every one hour

Hi team, i have a requirement that,
we have to send one email , for every one hour from 6am to 6pm eastern pacific for only 1st 10 days only.

Say Example : 01-08-2022 to 10-08-2022 only.//6am to 6pm 

How to write the expression of below.

How to Execute below code from developer console :-
ApexScheduledClass  m = new ApexScheduledClass ();
String sch = ??????? //need to add to fire at 1st 10days of every month form 6am to 6pm,
String jobID = system.schedule('Merge Job', sch, m);
How add the time for the particular specific scenario. 
Please suggest your suggestions.
Thanks
Sfdx
 
VinayVinay (Salesforce Developers) 
You can try something like below.
 
public with sharing class MyScheduleStart implements Schedulable
{
    public void execute(SchedulableContext ctx) 
    {
        System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );  
    }
}

https://www.biswajeetsamal.com/blog/schedule-batch-apex-for-every-hour/
http://blog.shivanathd.com/2013/01/run-batch-class-hourly.html

Please mark as Best Answer if above information was helpful.

Thanks,
mukesh guptamukesh gupta
HI,

Please have look on below url:-

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


if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh
salesforce sfdxsalesforce sfdx
Hi all, firstly thanks for your valuable suggestions, 
The thing is i need to schedule the apex class for every one hour 6am to 6pm for 1st 10days
will it be possible
Please suggest your valuable comments
thanks