Learn About Importing and Exporting Data
Learning Objectives
After completing this unit, you’ll be able to:
- Give two reasons why the import and export schema files are important.
- List two types of data that you typically import into a system of record.
- Describe two import and export modes.
- Describe the export process.
- Explain why a delta feed is important.
Introduction
Most merchants have back-end systems, which are their systems of record. The Salesforce B2C Commerce environment has its own databases and servers designed to support storefronts. The B2C Commerce import and export functionality bridges the gap.
Think of the flow of data: From a system of record to B2C Commerce and from B2C Commerce capture to a system of record. Site merchandisers develop product details such as SKU numbers, product descriptions, sizes, images, prices, and video in a system of record and then import them into B2C Commerce. Shoppers create orders and the external system processes them. For example, a merchant creates a coupon code and imports it into B2C Commerce. When a shopper redeems the coupon, the system exports the redemption data.
Import uses data from an external file to populate the B2C Commerce database. Export extracts data from the B2C Commerce database. You can use the exported data to create XML files that you can use as feeds for external systems. A feed is a specific import or export process.

Data is exported from production.
Processes that Are Not Import and Export
These specialized processes don’t align with the broader definition of data import and export, which typically involves transferring data between Salesforce and external systems.
-
Data replication is when you copy code and data from one instance to another. We talk about data replication in the next unit.
- The Business Manager catalog feed feature processes third-party files (such as for Certona).
-
Site import and export moves site-specific configuration and setting information from one instance to another.
Schemas
Schema files specify the file structure expected by B2C Commerce import and export. B2C Commerce only accepts XML import files formatted by these schemas. The schemas also document the required data attributes. The import requires the data to match the schema for success.
B2C Commerce exports in XML format, except for coupon codes, which export to CSV format. Salesforce recommends you use a third-party program to process .csv files into the required XML format. It’s a lot faster and more efficient to transform a file by using a pure .NET or a Java platform with a large amount of memory allocated to the processing.
So, what are these schema files? It turns out there are several them. Here are some examples:
- sort.xsd
- coupon.xsd
- couponredemption.xsd
- order.xsd
- Promotion.xsd
Modes
You specify an import mode to define how B2C Commerce interprets the data within an import feed. The mode applies to all objects within a feed, and to all import files defined by the schemas.

Import Modes
Mode |
Descriptions |
|---|---|
Merge |
Merge mode creates an object if it doesn’t exist and performs the update on the object. |
Update |
Update mode updates an existing object. The feed updates provided object attributes and leaves untouched object attributes that aren’t provided. If an object doesn't exist, the update doesn’t create the object. |
Replace |
If the object dosen’t exist, replace mode recreates an object with the data provided in the feed. During the import, Replace mode removes existing attributes that the feed doesn’t provide. Replace mode is the same as a delete followed by a merge. |
Delete |
Delete mode removes an object from the database. Youprovide the object ID in the feed. The system ignores the other object attributes. |
Be careful when you delete objects in an import. Delete mode deletes objects that are in the feed. Likewise, replace mode deletes and then re-creates objects that are in the feed. Performing a replace import just to change one object deletes the entire object set.
Some schemas support an attribute mode at the import element level. In this case, the only supported mode is delete, where the import mode for the process can be overwritten for a particular element. This approach is useful with changed information, where a single import process creates, updates, and deletes objects.
Production Feeds
Salesforce recommends that production feeds contain only changes from the previous feed. These feeds are delta feeds. They’re smaller to archive, faster to import, and easier to troubleshoot. However, some schemas have elements that override the global import mode and always use the replace mode. Because these elements require the full set of objects in each import, you can’t include them in delta feeds.
List-Type Elements
The standard behavior for list-type elements in the XML files is to replace the entire list, regardless of import mode. If the list element isn’t contained in the import file:
- Merge mode keeps the list.
- Replace mode deletes the list.
The Import and Export Process
Create an XML file that exactly follows the B2C Commerce schema. This import process outlines the steps.
- Use WebDAV, SFTP, or HTTPS to transfer the XML file from your back-end system to a B2C Commerce instance.
- For staging or production instances, set up a secure connection for the file transfer. Sandboxes don’t require it.
- Import the XML file into the instance by using Business Manager, or create a custom controller. B2C Commerce provides import pipelets for most standard imports that can deal with large datasets, are fast and reliable, and use system resources efficiently. Use them when you load business objects into B2C Commerce instead of using custom logic with B2C Commerce script or pipelets.
These steps represent a typical export process.
- Manually export the database objects to an XML file by using the schemas through Business Manager, or create a custom controller. You can use B2C Commerce export pipelets for most exports. In some cases, they offer more granular control over the objects than Business Manager. To automate data exports, you create a controller.
- Transfer files from the instance to the merchant back-end system.
- To meet PCI-DSS (security) requirements for transferring the data or for back-end system requirements, configure a secure connection.
Instance-Specific Details
You use B2C Commerce import and export in different ways, based on the instance type. Here we explore each instance type separately.

Sandbox
When developing your site, each developer uses a separate sandbox. Create an initial sandbox and use it as a template for other sandboxes.
You first transfer data files from your local machine to the instance. Then you import the data into the instance database by using Business Manager. When your first sandbox contains the configuration and data your development team needs, use Site Export to export the site contents and configuration. Then, download them to your developer machines.
.
During development, you can import new product and price feeds directly into each sandbox. Each sandbox uses the same import files, but you import them independently. You also have the option to create custom controllers to automate data import. This approach supports automatic data import for staging and production systems. Another sandbox can then use Site Import to get the configuration and contents.
Staging and Production
The primary instance group (PIG) contains the development, staging, and production instances. Use a custom controller to move data via a secure connection from a back-end system to one of these instance types. For infrequent feeds, import them only into staging and then replicate them to production. This import to staging protects your production instance from problems with imported data.
Some feeds can require extra enhancement in Business Manager; for example, to add web-only descriptions or other information manually. You update feeds that require enhancement in staging and then replicate the data to production.
It’s not practical to stage and replicate data that changes frequently. Import frequent feeds, such as pricing or inventory updates that occur every 10 minutes, directly into production. Import frequent feeds into staging and production at the same time, so the instances remain synchronized. Try to keep the staging and production instances the same.
Use controllers for added import and export flexibility. Add business logic to your controller to add values to your import file, update search indexes automatically, or archive the import file. When you export data from production, you can add business logic to your controller to change the format of the export file, add values, or do other processing.
Development
A development instance is the testing environment for your production instance. You can do an initial site import and export from a staging to development instance to set it up. After that, use data replication to update data and code on that instance.
Next Steps
You learned about schemas, modes, and the B2C Commerce import and export process details. Next, learn about replication, which moves code and data from one instance to another.
Resources
Salesforce Help: Import and Export in B2C Commerce
