How to invoke batch apex job (or) how to execute the batch apex job programatically?



How to invoke batch apex job (or) how to execute the batch apex job programatically?..

Answer / Rajnath Kumar

"To invoke a Batch Apex Job programmatically, you can use the Database.executeBatch() method. Here's an example:

1. Create an instance of your Batch Apex class.
2. Pass an Iterable<SObject> list to the start method in the constructor of the Batch Apex class instance.
3. Call Database.executeBatch() on the AsyncApexJob object, passing your Batch Apex instance as a parameter."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

What is the lead process?

1 Answers  


What are custom reports? : salesforce admin

1 Answers  


Can we avoid deletion of records through validation rules?

1 Answers  


What is the difference between public and global class in apex? : salesforce crm

1 Answers  


Difference between isblank and isnull?

1 Answers   Cognizant,


How can you create visualforce page in salesforce? : salesforce visualforce

1 Answers  


What is Access at the Role Level?

1 Answers  


What is a Batch Apex?

1 Answers   Cognizant,


Can you tell me about export and export all with reference to data loader?

1 Answers  


What are the different Annotations in Salesforce and tell me with examples?

1 Answers   Cognizant,


What are the time-dependent workflow – considerations ?

1 Answers  


What are custom report types?

1 Answers  


Categories