Activity Forums Salesforce® Discussions What is the use of Database.statefull Interface in salesforce?

  • Saurabh

    April 10, 2017 at 1:59 pm

    Hi Suraj

    Batch Apex is stateless by default. That means for each execution of your execute method, you receive a fresh copy of your object. All fields of the class are initialized, static and instance. If your batch process needs information that is shared across transactions, one approach is to make the Batch Apex class itself statefull by implementing the Statefull interface. This instructs to preserve the values of your static and instance variables between transactions.

    Hope it may helps you:


  • Avnish Yadav

    September 30, 2018 at 3:11 am


    You can read this blog here for better understanding.


Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos