1

We are doing Salesforce (old instance) to Salesforce (new instance) migration. We have Standard and custom objects in our old instance which are needed to be migrated to the new Salesforce instance. We are doing this in the following steps:-

1: Using salesforce describe rest api create tables in MySQL with similar mapping of salesforce object. Tables are created with referential integrity using "referenceTo" field of describe call. Example: services/data/v49.0/sobjects/User/describe/.

2: Get data from salesforce using query rest api and put into MySQL tables. Example: /services/data/v39.0/query/?q=.

3: In this part, we have some confusion like which api we should use so that we can push records to destination org.

We are using Python for this task.

1

You can use the composite sobject rows if you do not have a large payload of the order of 100K

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections.htm

A single request can take 200 records so you will group the requests in this approach.

Another way is to use the new graph composite api.

This api is available as of today from winter 21

You can find details below

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph.htm

Work your payload so as to avoid the limits mentioned below.

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_graph_limits.htm

This api can have 500 subrequests and hence is more powerful than simple composite api

Use a bulk API for large payloads of the order of millions.

https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/create_job.htm

You can get the processed IDs using the below API for bulk jobs

https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/get_job_successful_results.htm

| improve this answer | |
  • Bulk api batch results do not return newly created Id in destination org which we need to update in child records. Composite API return newly created Id with reference Id (which is old id, so that we can update child object in MySQL before sending them). Composite API have limit of 200 records in single request. – Amit Kumar Oct 17 at 20:47
  • @amit Results do return response once job is processed! You have to call the right api – Mohith Shrivastava Oct 17 at 20:54
  • Thanks, @Mohith Shrivastava, – Amit Kumar Oct 18 at 8:36
  • We have a total of 100 objects (20 standard, 80 custom) which are needed to be migrated. Most of them are related to other objects with parent-child relationships.So if we use bulk api which are asynchronous in nature, so it can take some time to complete (which may vary). – Amit Kumar Oct 18 at 8:40

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.