function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi,
I have a class.
How can i execute this class each minute using scheduling apex?
Thanks,
ANKITA
YourClassName m = new YourClassName(); String sch = '20 1 8 10 2 ?'; system.schedule('Job', sch, m);
Here SCH represents : "Seconds Minutes Hours Day_of_month Month Day_of_week optional_year"
So you can change it accordingly.
For more reference over schedule jobs please visit : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Thanks
Ankit Arora
Blog | Facebook | Blog Page
HI ANKIT,
But this will execute @ 8:1:20 on 10day of 2nd month
20 1 8 10 2
at this time interval only.
I need to execute my class per each minute (daily).
Yes. I got it.
Its possible using
System.debug('-----------ScheduleMinute---------');
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute() + 1);
String ss = String.valueOf(Datetime.now().second());
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
System.debug('-----------nextFireTime---------' + nextFireTime);
ScheduleMinute s = new ScheduleMinute();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
and goto Apex classes -> schedule apex -> and set the start date and end date here.
Here SCH represents : "Seconds Minutes Hours Day_of_month Month Day_of_week optional_year"
So you can change it accordingly.
For more reference over schedule jobs please visit : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Thanks
Ankit Arora
Blog | Facebook | Blog Page
All Answers
Here SCH represents : "Seconds Minutes Hours Day_of_month Month Day_of_week optional_year"
So you can change it accordingly.
For more reference over schedule jobs please visit : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Thanks
Ankit Arora
Blog | Facebook | Blog Page
HI ANKIT,
Thanks
But this will execute @ 8:1:20 on 10day of 2nd month
at this time interval only.
I need to execute my class per each minute (daily).
Thanks,
ANKITA
Yes. I got it.
Its possible using
System.debug('-----------ScheduleMinute---------');
String hour = String.valueOf(Datetime.now().hour());
String min = String.valueOf(Datetime.now().minute() + 1);
String ss = String.valueOf(Datetime.now().second());
String nextFireTime = ss + ' ' + min + ' ' + hour + ' * * ?';
System.debug('-----------nextFireTime---------' + nextFireTime);
ScheduleMinute s = new ScheduleMinute();
System.schedule('Job Started At ' + String.valueOf(Datetime.now()), nextFireTime, s);
and goto Apex classes -> schedule apex -> and set the start date and end date here.
Thanks,
ANKITA