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
BV APIBV API 

Updating records is a transaction

Is there an API that I can use to update records in a a transaction?
- if I update 10 records - either they all fail (no update) or all succeed. (so if one of them fails due to a validation issue, they all fail)


Balaji BondarBalaji Bondar
Use DML methods from database class:

List<Database.SaveResult> resultList  = Database.update(listToRecordsToBeUpdated, false);

DML database methods - allows partial success of bulk DML operations. Records that fail processing can be inspected and possibly resubmitted if necessary.

The optional opt_allOrNone parameter specifies whether the operation allows partial success. If you specify false for this parameter and a record fails, the remainder of the DML operation can still succeed. This method returns a result object that can be used to verify which records succeeded, which failed, and why.
Return Value.

Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.
BV APIBV API
Sorry, now I understand that my question wasn’t clear.
I’m actually asking about API for updating records remotely. We have Python code on our backend that communicates with SalesForce. I saw the Bulk API, but it doesn’t seem to support transactaction.
Thanks!