Bulk Api v2 provides successful and failed records in two different files. This means if there are some records failed in between a batch, then we will not be able to correlate those failed records source records.

For ex., let's say you have 10 records out of which rec5, and rec7 failed. Now success file contains record (rec1-rec4, rec6, rec8-rec10) and failed file contains (rec5 and rec7). This completely re-orders the records compared to source record.

If it is operations (involves id), you could use that to correlate source records but for insert and upsert, it is not possible.

I tried to add a dummy field like "external__id" and process the files but batch completely failed because of unrecognized field.

How have you solved this problem?

  • If you call the failed results API, you get the original record in the response – identigral Sep 3 at 20:26
  • You will get original record but record index positions are messed up. If we have a unique, we can use that value but most of the time, record fields are not unique and that is the issue Im trying to understand how to resolve. – realfire Sep 3 at 21:39
  • Right. You want an external ID field or any field that acts as a logical key. The latter may or may not be classified as an external ID. – identigral Sep 3 at 21:59
  • I agree external id field would work. But bulk v1, returned results in the same order we posted the records so we could always correlated correctly. Anyways, as somebody said, bulk v2 is poorly designed with so many confusions. – realfire Sep 4 at 17:15
  • 1
    Might be worth creating an idea if you think other folks could benefit from position-based correlation in v2 – identigral Sep 4 at 17:21

Answering my own question here.

It is not possible to correlate the bulk v2 results based on the upload positions to the input file. This may not be an issue for many use cases but for the product we were building, it is critical so that we can provide the feedback on the status of each record as status file.

So we end up reverting to use Bulk v1 till such feature becomes available in v2.

| improve this answer | |
  • As an alternative, without even if creating an external Id, you can create a dummy column in the csv dataset and load the data, this way you can compare with source file – Santanu Boral Sep 17 at 18:31
  • I tried it but sfdc throws error stating that dummy column is not a valid field. – realfire Sep 17 at 19:02

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.