Skip to content
Log in

Move data from sandbox to production

On this page

Use this process to move StoreConnect records from a sandbox into production. The same approach works between any two Salesforce orgs.

Before you begin

  • Confirm the StoreConnect package version matches in both orgs. Check Setup > Installed Packages in each. A version mismatch means fields may not exist in the target org.
  • Install a data loader that can export records and their relationships, such as dataloader.io.
  • List every object you plan to migrate, using the full list of StoreConnect objects as your guide.
  • Plan the insert order around data dependencies before you export anything. See plan the migration below and the example insert order at the end.

:::warning Some things do not migrate and must be handled separately or by hand:

  • StoreConnect settings metadata can be exported, but you can only update those settings manually in the production org. See Setup > Custom Metadata Types.
  • Media files move separately. See media imports below.
  • Domains and mail addresses should not be copied across. They differ between environments, and overwriting a production domain takes the live store down.
  • Salesforce record IDs from the sandbox do not exist in production. Never map a field containing a Salesforce ID to a lookup field in the target org. :::

Export recommendations

  • When exporting an object, include all its fields plus a unique identifier from any related objects. Use StoreConnect’s External IDs to re-establish the links in the production org.
  • To keep the record owner on each record, export the Username field, then edit the export file to strip the .{SandboxName} suffix from the end of each username.

Export the StoreConnect external ID with records

All StoreConnect records have a StoreConnect External ID that is unique and can be used to help match imported records.

If you need to bring over non-StoreConnect objects, you will need a unique field to reference. You can use the Salesforce Record ID, or add a special text field to the object in the other org to hold that ID temporarily, until the migration is completed.

Example: export trait records

Trait records have a dependent relationship: every Trait Type belongs to a Trait Category, and Trait Values belong to a type. See product traits for how the three fit together, and apply product traits using templates if your store also uses trait templates, which have their own records to migrate.

To relate each Trait Type to the correct Trait Category, include the StoreConnect External ID of each trait category in the export file.

Data loader field selection showing all fields selected for the trait export

Data loader field selection showing the related trait category External ID added to the export

Plan the migration

Import objects in a logical order that accounts for dependencies such as custom lookups. Expect to test your first approach and adjust the plan.

Dependencies

A dependency is where one object needs another to exist before its values can be imported. Identify these before you start.

Circular dependencies need two passes. Page has a lookup to Store, and Store has lookups to Page. Insert the Store records first without mapping any lookups to Page, then insert the pages, then come back and update the store records with the page lookups.

Do the same wherever records reference another record on the same object, such as Page and Article Category.

Record mapping in the CSV

Map the exported data column by column, using the StoreConnect External ID as the reference where IDs must be maintained between objects.

Optional identifier fields that do not need pre-populating, such as Owner ID, populate automatically if you leave them blank.

Data loader mapping screen showing Source Header, Sample Data, and Salesforce Field columns

Source Header is the column header in the export CSV, Sample Data is the value from the first record in that CSV, and Salesforce Field is the field you are mapping the column to in the production org.

Media imports from the StoreConnect CDN

If you use StoreConnect’s content delivery network (CDN) to store and reference media, the production URLs need to point at production CDN files.

In the CSV, map the existing URL column to the Import URL field in your production org, and map nothing to the URL field. When Import URL has a value and URL is blank, StoreConnect generates the new URLs for you rather than you updating each one by hand.

Data loader mapping for media records, with the source URL column mapped to the Import URL field

Verify the migration

Once the import is complete, confirm it worked before you rely on the production org:

  1. Compare record counts per object between the two orgs, and account for any difference.
  2. Open a sample of records and confirm their lookups resolve to the right related records, rather than being blank or pointing at the wrong record.
  3. Open the production storefront and check that categories, products, prices, pages, and menus all render.
  4. Confirm media displays on product and content pages, which shows the CDN URLs generated correctly.
  5. Confirm each Store record still has its own production domain and has not been overwritten with the sandbox value.

:::tip Make your next round of changes in the sandbox rather than production, particularly anything driven by an AI agent, then migrate it across using this process. See build on StoreConnect using AI agents. :::

Tips and troubleshooting

  • Missing picklist values. Picklist values in the sandbox may not exist in production. Add them manually, then re-insert the records that failed.
  • Duplication errors on products and price book entries. StoreConnect’s shipping and promotion products are added by the package at install time. They do not need importing or updating, so these errors are safe to ignore.
  • Store domains. When updating a Store record, do not overwrite the domain. It differs between the staging and production websites.
  • Sending addresses. Confirm each store’s Mail From Address is set up as an Organization-Wide Address in the production org.

Example of insert order

This is a guide only. Build your own insert order to account for the data and field dependencies in your org.

  1. Pricebook2
  2. Media__c
  3. Country__c
  4. Zone__c
  5. Zone_Country__c
  6. Tax__c
  7. Content_Block__c
  8. Content_Blocks_Children__c
  9. Trait_Category__c
  10. Trait_Type__c
  11. Trait_Value__c
  12. Stock_Location__c
  13. Store__c
  14. Transactional_Email__c
  15. Shipping_Provider__c
  16. Payment_Provider__c
  17. Shipping_Rate__c
  18. Taxonomy__c
  19. Product_Category__c
  20. Product_Category_Hierarchy__c
  21. Content_Blocks_Product_Categories__c
  22. Page__c
  23. Content_Blocks_Pages__c
  24. Article_Category__c
  25. Article__c
  26. Articles_Article_Categories__c
  27. Content_Blocks_Articles__c
  28. Product2
  29. PricebookEntry
  30. Products_Product_Categories__c
  31. Content_Blocks_Products__c
  32. Product_Media__c
  33. Product_Tax__c
  34. Product_Variant__c
  35. Related_Product__c
  36. Trait__c

Was this article helpful?

Was this article helpful?