You need to sign in to do that
Don't have an account?

How to schedule the schedulable class for every one minute in salesforce?
can you please give me the example of schedule apex class for every one minute .How to solve the above scenario.please give some ideas.
Example 1:- Example 2:-
//schedule next execution after a minute
DateTime currentDateTime=System.now().addMinutes(1);
String nextScheduleTime=String.valueof(currentDateTime.second()) +' '+String.valueof(currentDateTime.minute())+' '
+String.valueof(currentDateTime.hour())+' '+String.valueof(currentDateTime.day())+' '
+String.valueof(currentDateTime.month())+' ? '+String.valueof(currentDateTime.Year());
JOBNAME Job = new JOBNAME();
system.schedule('Scheduled at '+System.now().format(), nextScheduleTime, Job );
Please let us know if this will help you.
Thanks,
Amit Chaudhary
You can schedule your class by using the System.schedule method.
The code below will get your scheduled job to run every minute
String sch = '0 * * * * *';
System.schedule('Jobs scheduled name', sch, new Job());
The format for schedule is given below -->>
Seconds - Minutes - Hours - Day_of_month - Month - Day_of_week - optional_year
* Specifies all values.So it will run for every minute of every hour on every day and so on...!!
Hope this helps..!!
Try with blow cod eit wil help .
You should writ eyour business logic in your BusinessLogic class .else you can write code inside your execute methos .
To Know more detail about the schedule class you can check the below link it will help .
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
let me know if it helps .
Write the class and execute an dto know the next schedule time you can query in workbench from the CornTrigger Object .
Let me know if it helps !!
Thanks
Manoj
Hi, Manoj
How to run the scheduled job above code please give some ideas.
Please execute below code in develope console.
//schedule next execution after a minute
DateTime currentDateTime=System.now().addMinutes(1);
String nextScheduleTime=String.valueof(currentDateTime.second()) +' '+String.valueof(currentDateTime.minute())+' '
+String.valueof(currentDateTime.hour())+' '+String.valueof(currentDateTime.day())+' '
+String.valueof(currentDateTime.month())+' ? '+String.valueof(currentDateTime.Year());
JOBNAME Job = new JOBNAME();
system.schedule('Scheduled at '+System.now().format(), nextScheduleTime, Job );
That will help you.
Basically there is a method in system class which takes three(3) parameter one is job Name ,second is corn expression , and third is your instance of your schedule class .
So you can execute the code in Developer console ,Whcih will create a record in CornTrigger object .and automatically schedule the class . To know more detail about the execte method in System class please cehck below link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_system.htm#apex_System_System_schedule.
Let me know incase any issue .
Thanks
Manoj
How to write the schedule apex class for above code.please give entire code with example.
Thanks,
Amit Chaudhary
How to schedule an Apex schedulable class to run for 10 days before in salesforce?
Here i want to schedule the 10 days before data.How to run the schedule job please give me the example of above scenario. please give some ideas.
Hi, Amit Chaudhary 8
How to query all the account created before 10 days and update their names.
Hi, Manoj
How to schedule an Apex schedulable class to run for 10 days before in salesforce?
can you please give me the example of above scenario.please give some ideas.
Please let us know if this will help u
Our company has a cool solution for problems like yours!
Try this https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000DqCmYUAV.
It allows you to execute your schedule at a specified frequency, even every 5 minutes.