2

I am performing multiple batch upserts using the Bulk API using an external ID field from my system. In order to determine which record ids from my system failed, I'd need the results rows to correspond to the rows in the request.

For example, I got this row back in the results:

"Id","Success","Created","Error"
"","false","true","FIELD_INTEGRITY_EXCEPTION:Date of Birth: invalid date: Mon Jan 02 00:00:00 GMT

The external id is not included in the result, so I have no way of knowing which record from my system failed.

I cannot find any information on the order of the results. Does anyone know if there is an authoritative guarantee that the results rows are in the same order as the request rows?

2

This Salesforce documentation page Handling Failed Records in Batches has this information as the first item of "Parse the results for each record" (bolding added by me):

Track the record number for each result record. Each result record corresponds to a record in the batch. The results are returned in the same order as the records in the batch request. It's important to track the record number in the results so that you can identify the associated failed record in the batch request.

which is about as good as you are going to get in terms of guaranteed behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.