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
kito kidkito kid 

schedular to run specific time

I set up to run the schedular by running the below statement in console. but when I check from ScheduledJob, it doesn't appear.

 

1) I want to run every 2 mintues between 5:30 - 5: 55 minutes.

 

System.Schedule('Testing', '0 30-55/2 17 * * ?', new Schedular_MySchedular());

 

If I don't set up per minutes, such as System.Schedule('Testing', '0 30 17 * * ?', new Schedular_MySchedular()); the job appears in ScheuledJob list.

 

What might be the issue?

 

2) If I want to run schedular for every hour, how can I configure it?

 

Thanks ahead.

Best Answer chosen by Admin (Salesforce Developers) 
Vinita_SFDCVinita_SFDC

Hello,

 

For minutes and seconds we do not have special character. Frequency for running the job should be equal to greater that one hour.

 

Salesforce schedules the class for execution at the specified time. Actual execution may be delayed based on service availability. Therefore short time durations are not allowed. For scheduling job run every hour you can write cron expression like:

 

('Testing', '0 0 1-17/1 * * ?', new Schedular_MySchedular());

 

For detail please refer below link:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm#using_schedule (Using the System.Schedule Method).

 

Hope this helps!

 

 

 

 

All Answers

Vinita_SFDCVinita_SFDC

Hello,

 

For minutes and seconds we do not have special character. Frequency for running the job should be equal to greater that one hour.

 

Salesforce schedules the class for execution at the specified time. Actual execution may be delayed based on service availability. Therefore short time durations are not allowed. For scheduling job run every hour you can write cron expression like:

 

('Testing', '0 0 1-17/1 * * ?', new Schedular_MySchedular());

 

For detail please refer below link:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm#using_schedule (Using the System.Schedule Method).

 

Hope this helps!

 

 

 

 

This was selected as the best answer
SachinSankadSachinSankad

Hi,

 

Minues & Seconds in scheduler doesn't support any special characters, so you can not schedule it after every 2 minutes.

 

Similarly, Salesforce supports schedule of an hour for scheduled apex/jobs.

 

To run scheduler every hour, you can configure like this :

 

System.schedule(0, 0, *, *, *, MON-FRI);

You can refer to following link for help :

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

 

Thanks,

Sachin.