• #23664
     Ratnakar #203
    Forcetalks

    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?

    Tagged: , , , ,

    #23692
    Salesforce | Subhendu Subhendu #305
    Forcetalks

    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

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

Please to reply to this topic.

CONTACT US

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

Sending

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 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?