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
Shivom Verma 35Shivom Verma 35 

Schedule batch apex class from Vf page

ShivankurShivankur (Salesforce Developers) 
Hi Shivom,

Please check out below thread to get idea over implementation on above request:

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Shivom Verma 35Shivom Verma 35
Hii Shivankur
In this example where is scheldulingjobs controller
Suraj Tripathi 47Suraj Tripathi 47
Hi Shivom Verma,

Try this:

what you can do is call apex controller from VisualForce page and in apex class schedule the apex batch class=>
global class BatchClass implements  Database.Batchable<sObject>, Database.Stateful {
    global Database.getQueryLocator start(Database.BatchableContext bc)
        return Database.getQueryLocator([data you want to fetch using query]);
    public void execute(Database.BatchableContext bc, list<object> objlist)
    public void finish(Database.BatchableContext bc)

 apex controller to execute batch 

BatchClass bc= new BatchClass ();
Database.executeBatch(bc,/*batch size*/);

call this controller on your VisualForce page.

If you find your solution mark this as the best answer.

Thank you!
Suraj Tripathi