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 Team how to schedule a Apex class for the below particular Scenario , thanks in advance

Hi team, i have a requirement that,
we have to send one email , Apex class is Ready and working fine.
Requirements:
1.Need to schedule it every one hour.
2.Need to schedule it in office time like 6am to 6pm.
3.Need to schedule it to work only for 1st 10 days of starting of every month.
Can any one give your valuable suggestion to perform this task.
Thanks in advance.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Generally below is the cron expression for the above mentioned scenerio.
 
0 6-18 1-10 * *

You can check the output of this in the below link.

https://crontab.guru/#0_6-18_1-10_*_*

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
salesforce sfdxsalesforce sfdx
Hi praveen added  the code as above .


scheduledMerge m = new scheduledMerge();
String sch = '0 6-18 1-10 * *';
String jobID = system.schedule('Merge Job', sch, m);


Getting the error of below:

System.StringException: Unexpected end of expression.

Can you please suggest your comments if you have 

Thanks