Is the order of update calls within one batch guaranteed?

We have an external application integrated with Salesforce that sends account information to Salesforce using the Soap API call upsert(), including status information. We have the problem that changes to the account sometimes happen so fast that one record is updated twice within one batch, and this is not supported by upsert() (see “When batch updating multiple records where the external ID is the same for two or more records in your batch call, those records will be marked as errors in the UpsertResult file. The records will be neither created or updated.”).

We are now thinking of using update() instead, because update() can handle up to six calls to the same record within one batch. Now I need to know if update calls within one batch are processed in the same order as they where send to Salesforce.

In other words: If two update calls, the first setting the field status = 100 and the second one with status = 110, are processed within one batch, will the result always be that the status field is 110 and never 100?


The only way to find the answer to this question is to test it. My suggestion would be re-architect the way you send the upserts to salesforce. A better approach might be:

  1. Send 1 record per upsert request at a time OR
  2. Send only the latest update in the upsert request instead of adding all updates to the upsert job. this is easier said than done, and may require adding a logic to check for uniqueness and only add the latest update to the batch sent in the upsert request.

Source : Link , Question Author : georg w. , Answer Author : Anup

Leave a Comment