- January 10, 2018 at 12:55 pm #23664Ratnakar #10
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?January 11, 2018 at 6:56 am #23692Subhendu #13
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.
Please Register to reply to this topic. /