function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
raj kiranraj kiran 

batch class to perform mutiple object field updates

Hi All,

I am looking for a way where we can implement the batch class which updates multiple object field values. here we will be passing the paramerts like api object names and field names to be updates dyamically.

Please let me know how can i acheive this?
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi Raj Kiran,

Can you explain business requirement ?
 
raj kiranraj kiran
Hi Ashish,

Thanks for interest.
Scenario is like this there will be a config object holding  the records of schema  selected object names and fields names from salesforce and a flag. once the user has selected an entry of the object name and field names will be saved as record. so  here there will be many records holding the same object name and  different field names.

Eg  : sample record data is like
Object Name, Field name, Flag val
Account ,        email,         true.
Account,          name,       true.
contact,          name,       true.

upon the data entry the trigger on config object will fire and its should update all the records of account and contact objects with some business logic to modify the data in select field names only as inserted in config object.

My approach was something like:
upon the user inserting the  object and field names, trigger fires and batch class runs to modify all the records of the objets and fields names passed to it.

I have seen batch processing for single object, As in  this case we need to  batch updation of the records for mutiple objects  which are passed dynamically.
Ashish_Sharma_DEVSFDCAshish_Sharma_DEVSFDC
Hi raj kiran,

Would these selected objects have relationship always ?
We use batch start method to initilize data to work upon ,but we can only initilize for single object and its related objects .
raj kiranraj kiran
Asish,

There is no relationship as such. just select some random object and then store it in some custom object. apply some  changes to all records of the saved object  fields. As the records will be in bulk, i have opted for batch process. just wondering how to acheive the bulk operations on multiple objest in salesforce.  and yes we use only for one object in batch processing hoping for any alternative workarounds.