Activity Forums Salesforce® Discussions How to invoke batch apex job (or) how to execute the batch apex job programmatically?

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

    Posted by Prachi on September 21, 2018 at 5:37 am

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

    Parul replied 6 years, 2 months ago 3 Members · 2 Replies
  • 2 Replies
  • shariq

    Member
    September 21, 2018 at 7:28 am

    Hi,

    Run Batch Apex
    1. From the Developer Console, click Debug | then Open Execute Anonymous Window.
    2. Execute the following code.
    Id <variable name>= Database.executeBatch(new <Class name>(), batch size);
    Example code
    Id batchJobId = Database.executeBatch(new RunThisBatch(), 200);
    NOTE: batchJobId will contain the job Id of the batch.

    Thanks

  • Parul

    Member
    September 21, 2018 at 7:35 am

    Adding code snippet

    Execute the following code.
    Id <variable name>= Database.executeBatch(new <Class name>(), batch size);

     

    Thanks

     

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos