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.

UpsertResult

The upsert() call returns an array of UpsertResult objects. Each element in the array corresponds to the sObject[] array passed as the sObjects parameter in the upsert() call. For example, the object returned in the first index in the UpsertResult array matches the object specified in the first index of the sObject[] array.

An UpsertResult object has these properties.

Name Type Description
created boolean Indicates whether the record was created (true) or updated (false).
errors Error[] If errors occurred during the call, an array of Error objects, providing the error code and description, is returned.
id ID If the call succeeded, the field contains the ID of the record that was either updated or created. If there was an error, the field is null. For more information, see ID Field Type.
success boolean Indicates whether the call succeeded (true) or not (false) for this object.

If your organization has active duplicate rules and a duplicate is detected, the UpsertResult includes an Error with a data type of DuplicateError.