You need to sign in to do that
Don't have an account?
BCDBSA
How to set up a VF page including buttons and date fields to run scheduled Apex class like scheduling reports
Hi All,
I have an Apex controller to a VF page. It will run everytime I click a button in the VF page. The controller works well. It's function is to clear a whole sObject old records and create a batch of new records.
When it comes to the second part to write a scheduled apex job, it is really confusing. There are a lot of posts about Apex Scheduler to run every hour or everyday. But would it be possible to set up a VF page just like the following (screenshot from Reports)? Users are able to choose wheter to start scheduling the apex job or stop scheduling; they can choose the date to start and cease; they can choose what time they would like the scheduled Apex job to run.
I would like to know if it is doable. Any hints or sample codes are welcomed. If you have ever seen any post similar to it, please shart it to me!
Thanks!
I have an Apex controller to a VF page. It will run everytime I click a button in the VF page. The controller works well. It's function is to clear a whole sObject old records and create a batch of new records.
When it comes to the second part to write a scheduled apex job, it is really confusing. There are a lot of posts about Apex Scheduler to run every hour or everyday. But would it be possible to set up a VF page just like the following (screenshot from Reports)? Users are able to choose wheter to start scheduling the apex job or stop scheduling; they can choose the date to start and cease; they can choose what time they would like the scheduled Apex job to run.
I would like to know if it is doable. Any hints or sample codes are welcomed. If you have ever seen any post similar to it, please shart it to me!
Thanks!
If you are interested in exposing an interface to users to let them schedule their batch jobs on their own schedule, then look at the 'Skoodat Relax' unmanaged package. More information can be found at https://github.com/zachelrath/Relax . In order to really schedule anything other than a very simple update, or delete, you will need to create a class that implements the Apex.Scheduleable interface, and most likely, the Database.Batchable interface as well. Sadly, there really is no way around that. I hope this helps you.
Good Luck!
All Answers
I know I can go to Setup and schedule Apex jobs like that, but what I really want is to let other users to choose time and frequency from the VF page.
Would it be able to do that?
Thanks
If you are interested in exposing an interface to users to let them schedule their batch jobs on their own schedule, then look at the 'Skoodat Relax' unmanaged package. More information can be found at https://github.com/zachelrath/Relax . In order to really schedule anything other than a very simple update, or delete, you will need to create a class that implements the Apex.Scheduleable interface, and most likely, the Database.Batchable interface as well. Sadly, there really is no way around that. I hope this helps you.
Good Luck!