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
sowmya chilukurisowmya chilukuri 

Partial success of a bulk DML operation not working in batch class. I have a batch class with a list of 2 records supposed to update a field on record. But I see the update fails to update both records .

The two records in the list has validation rule fired, out of which one record has valid data and other has invalid which means validation fired. But the update failed on both showing the validation on both records. Also the batch class has database.saveresult and checked the error message which shows same on the records. does Database.update work on making partial update?
PhilipMB1PhilipMB1
Have you tried the additional "allorNone" parameter on the Database.Insert method?
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm#apex_methods_system_database
sowmya chilukurisowmya chilukuri
Hi,

I did try with passing false parameter in the Database.update(nameOfList, false). This is same as allorNone right?
PhilipMB1PhilipMB1
Yes - the same - in theory it should allow a partial save if you pass the parameter as Solved. Did you check the records to see if the update worked? You can also use the system.debug to examine the Database.Saveresult object returned to see the errors.
sowmya chilukurisowmya chilukuri
Hi, 

yes I did use database saveresult and trying to look for the success and error records using getfields() but still the second good record which is supposed to be updated did not get the field update happened.