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
Chris987654321Chris987654321 

Upserting through the API

I noticed that in Apex when you perform an upsert, there's an overloaded version of the method which allows for a boolean which indicates how Salesforce will handle duplicates. If it's false then if there's an error with upserting one record it will not fail the whole batch. If it is true then it will.

 

I do not see this overloaded version of upserting available through the API in either the partner or enterprise WSDL. Is this not available through the API by design?

 

Thanks,

Chris

dkadordkador

This feature is in the Winter '11 release.  Please see http://na1.salesforce.com/help/doc/en/salesforce_winter11_release_notes.pdf for details.

sfdcfoxsfdcfox

Before the new header, the following logic was always used in the API:

 

1) Attempt transaction.

2) If no errors, commit to database, else continue.

3) Remove error records, attempt rest.

4) If no errors, commit to database, return errors, else continue.

5) Remove error records, attempt rest.

6) If no errors, commit to database, return errors, else continue.

7) Fail the entire batch, return too many retries error.

 

As stated in the release notes, the new API can cause step 2 to return a fatal error instead of continuing on with the rest of the logic.