Activity Forums Salesforce® Discussions Update Multiple sobject records batch class in Salesforce

  • Subhendu

    Member
    January 11, 2018 at 6:56 am

    Hi Ratnakar,

    Yes, you can update different sObject records in a single batch class. You will have to create a batch implementing  Database.Batchable<String>, and Database.Stateful. Then create List of sObjects to store the records that you wish to update. Initialize the list in the constructor. Now, populate the lists in Start with the records that you will be processing in next steps. Access these lists in Execute method and perform Operations on it. Since you have implemented Database.Stateful, you will be able to perceive the values populated in lists throughout the Batch.

    Hope this helps.

    Thanks,
    Subhendu

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos