• #23664
     Ratnakar #199

    Update Multiple sobject records batch class in Salesforce

    Is it possible to update records of different sObject in single batch class. If yes, how can we do that?


    Salesforce | Subhendu Subhendu #583

    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.


Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?