0

I am currently working on an existing integration for syncing price-book entries from an external system to Salesforce. The system is using Apex Bulk API.I already know that in Salesforce it is mandatory for a product to have a standard price-book entry before adding a custom price-book entry.

The existing approach was creating a CSV file and that will first have all the standard price-book entries and in the same CSV file will have custom price-book entries just after the standard ones. The catalog size is less than 10k for now.

What am wondering is that does Salesforce guarantees the order in which CSV file entries are processed i.e. are they processed in the order specified in the file or it can be random as well. I already know if you have multiple chunks Salesforce processes them in parallel by default but I couldn't find anything in the documentation around the entries in the same file.

1 Answer 1

1

In my experience, Yes, all the records in the same file are processed in the same order as within the file if you're using Version 1 (V1) of the Bulk API. The chunking that happens within each batch file is that the records are processed 200 at a time serially. As far as I know, the order the batches are processed isn't guaranteed when there are multiple batches with V1 and it's running in Parallel.

With V2 of the Bulk API, one simply uploads a single CSV file and Salesforce chunks it automatically and processes the records in Parallel. V2 only supports Parallel as of today so the order can't be guaranteed.

With less than 10,000 records, using V1 and a batch size of 10,000 should get you the desired outcome. If the volume grows to more than 10,000, use V1 with "Serial" mode and then create a batch(es) with the standard price book entries first and then insert the batches with the custom price book entries since the API seems to insert the batches in the order created. Of course, test these ideas to confirm! If that doesn't work, you can use another non-Bulk API to sync the records up to 200 records at a time and I would expect you to still be well within the API limit.

Hope that helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .