Activity › Forums › Salesforce® Discussions › i want to count how many times execute method executed in Batch class?

  • Manpreet

    Member
    April 27, 2017 at 1:40 PM

    Hi Saurabh,

    Hi,

    the start method excutes once, at the begining.

    For the execute method, it depends on you.

    You can launch it through an Apex command :

    Database.executeBatch(new nameOfYourBatchClass(optionalParamInConstructor), 1);

    Here, the second param in the executeBatch method (the value 1) is the scope ; it means you want the batch to handle the elements 1 by 1.
    For instance, if the batch has to deal with 10 elements, the execute method will executes 10 times.

    Thanks.

Log In to reply.

Popular Salesforce Blogs

How Salesforce Boosted the Reach of MrBeast’s $1M Puzzle

Blog in

Salesforce partnered with YouTuber MrBeast for a groundbreaking Super Bowl campaign that turned a traditional ad into an interactive $1 million puzzle hunt, massively amplifying…

Popular Salesforce Videos