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
venkatsforcevenkatsforce 

call the batchapexclass from visualforcepage button

I want to call the batchapex calss using visualforcepage on the time of clicking the button in visualforcepage.........

 

 

 

Thanks

==========

VenkatSforce

Niket SFNiket SF
Hey, venkat it's possible.. you need to call bactapex execution from the buttons action method and it will work.

Thank you
Niks
venkatsforcevenkatsforce

Batchapexclass contains three methods start,execute,finish these are all assigned as global with parameter as Database.BatchableContext,then how to call?plz any examples.....Niks

 

 

 

thanks

===========

VenkatSforce

Niket SFNiket SF
dude you need to call only Start method .. Others will call automatically.

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

Thank you
Nik's
venkatsforcevenkatsforce

It shows error  ...Method does not exist or incorrect signature: Batchexamupdate.start() ,Batchexamupdate is my batchapexcalss name...

Niket SFNiket SF
Batchexamupdate objBatchexamupdate = new Batchexamupdate();
ID batchprocessid = Database.executeBatch(objBatchexamupdate);


you need to start in this way .. it will call start method --> then execute -> then --> finish..


Thank you
Nik's
venkatsforcevenkatsforce

Batchexamupdate objBatchexamupdate = new Batchexamupdate(); ID batchprocessid = Database.executeBatch(objBatchexamupdate);

I Use  ths code  n Controller class as batchcall,it shows the error as constructor not defined for Batchexamupdate...

 

Niket SFNiket SF
Then write the constructor :)

public Batchexamupdate()
{
}

Done.

Thank you
Nik's