Newer Version Available
Update Multiple Records with Fewer Round-Trips
Use a PATCH request with sObject Collections to update up to 200 records, returning a
list of SaveResult objects. You can choose whether to roll back the entire request when an error
occurs.
Request Syntax
PATCH /vXX.X/composite/sobjects
Parameters
| Parameter | Description |
|---|---|
| allOrNone | Optional. Indicates whether to roll back the entire request when the update of any object fails (true) or to continue with the independent update of other objects in the request. The default is false. |
| records | Required. A list of sObjects. In a POST request using sObject Collections, set the type attribute for each object, but don’t set the id field for any object. |
Usage Guidelines
- The list can contain up to 200 objects.
- The list can contain objects of different types, including custom objects.
- Each object must contain an attributes map. The map must contain a value for type.
- Each object must contain an id field with a valid ID value.
- Objects are updated in the order they’re listed. The SaveResult objects are returned in the order in which the update requests were specified.
- If the request body includes objects of more than one type, they are processed as chunks. For example, if the incoming objects are {account1, account2, contact1, account3}, the request is processed in three chunks: {{account1, account2}, {contact1}, {account3}}. A single request can process up to 10 chunks.
- You can’t update records for multiple object types in one call when one of those types is related to a feature in the Salesforce Setup area.
Request Body Example
1PATCH /composite/sobjects
2{
3 "allOrNone" : false,
4 "records" : [{
5 "attributes" : {"type" : "Account"},
6 "id" : "001xx000003DGb2AAG",
7 "NumberOfEmployees" : 27000
8 },{
9 "attributes" : {"type" : "Contact"},
10 "id" : "003xx000004TmiQAAS",
11 "Title" : "Lead Engineer"
12 }]
13}Response Body Example
1[
2 {
3 "success": true,
4 "id": "001xx000003DGb2AAG",
5 "errors": [],
6 "warnings": []
7 },
8 {
9 "success": true,
10 "id": "003xx000004TmiQAAS",
11 "errors": [],
12 "warnings": []
13 }
14]