Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Update Records Using sObject Collections

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.
  • 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.

    Using sObject Collections to update blob data requires more values in the attributes map. For more information, see Using sObject Collections to Insert a Collection of Blob Records.

    Note

  • 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.

If the request isn’t well formed, the API returns a 400 Bad Request HTTP Status. Fix the syntax of the request and try again. If the request is well formed, the API returns a 200 OK HTTP Status. If an item was processed successfully, the success flag shows for that item. Error information is returned in the errors array.

Syntax

URI: /services/data/vXX.X/composite/sobjects/

Formats: JSON, XML

HTTP Method: PATCH

Authentication: Authorization: Bearer token

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 records. Set the id and type attribute for each record.

Note: If the sObject Collections request is embedded in a Composite request, the Composite request’s allOrNone parameter can also affect the results. See allOrNone Parameters in Composite and Collections Requests.

Example

Example Request

Example Request Body

Example Response Body

Example Response Body (Some Items Failed and allOrNone is false)

Example Response Body (Some Items Failed and allOrNone is true)