Understand Import Modes
- Explain the purpose of the import modes.
- List two modes that add new objects via import.
- Describe how you can delete data using import.
- Explain the two general ways you can import or export data.
- Describe how Salesforce B2C Commerce is designed to handle storefront data.
Linda Rosenberg, Cloud Kick’s new administrator, is almost ready to use the import/export capability in Business Manager. Her manager asks her to hold off until she fully understands how modes work. Aside from schemas, modes are the most important aspect of the import/export function.
While schemas define data file structure rules, modes define what happens to the data at import. These are the modes.
Here’s what each one does.
|With this mode...||This happens...|
|Merge||Business Manager adds new data if it doesn’t exist and updates existing data.|
|Update||Business Manager updates existing data but does not add new data. It updates only the attributes that are in the XML file.|
|Replace||Business Manager re-creates existing data or adds new data per the data in the XML file. Business Manager removes existing attributes that are not in the XML file. This mode is the same as a delete followed by a merge.|
|Delete||Business Manager removes data in the XML file from the database. You only need to provide the object ID in the XML file. Business Manager ignores the other object attributes.|
Senior merchandiser Traude Beck asks Linda to help with product and attribute changes. Traude wants to add a Pinterest flag to a few products as a test. Previously, she tested a Facebook flag and now wants to remove that attribute.
Linda creates a table of the changes that Traude wants so she can decide which mode to use. Traude’s changes cover the objects T-123440 to T-123445. In the table, the letters A through F are a way to abbreviate the changes to the database. For example, the product T-1234440 is already in the database, and Traude wants to add the pinterest-enabled-flag true attribute to it.
A represents the product in the database:
A1 represents the product plus the attribute change:
<product product-id="T-123440"> <pinterest-enabled-flag>true</pinterest-enabled-flag>
|Change||Already In Database||Product (object)||Attribute|
|A1 - Add attribute||Yes||<product product-id="T-123440">||<pinterest-enabled-flag>true</pinterest-enabled-flag>|
|B1 - Delete attribute||Yes||<product product-id="T-123441">||<facebook-enabled-flag>true</facebook-enabled-flag>|
|C - No change||Yes||<product product-id="T-123442">||
|D - New product||No||<product product-id="T-123443">||
|E - Not in XML file||Yes||<product product-id="T-123444">||
|F1 - Change attribute||Yes||<product product-id="T-123445">||
For each mode, this is what would end up in the database.
|Pre-Import||In the XML File||Import Mode||Post-Import|
|A, B, C, E, F||A1, B1, C, D, F1||Merge||A1, B, C, D, E, F1|
||Update||A, B, C, E, F1|
||Replace||A1, B, C, D, E, F1|
Linda sees that the modes alone don’t allow her to make the B1 - Delete attribute change listed in her table. That’s why she still sees B, not B1, post import. To remove the Facebook flag attribute, she needs to change the attribute value in the XML file to none or blank and then import with the merge or update mode.
For the delete mode, all objects in the import are deleted, even if, like with C, there's no change.
For the update mode, Business Manager doesn’t add D to the database. Why? Because update mode does not add new data.
Business Manager doesn’t remove E in any of these scenarios because nothing happens to objects that aren’t in the XML file.
One way that Linda can delete objects is to create an XML file that contains only the objects she wants to delete and then import them using delete mode. The other way to delete objects is to specify the delete import mode at the object level in the XML feed. We talk about that next.
Modes for Elements
Traude comes to Linda for help once again. This time, she wants Linda to update the catalog with three new products, and delete two products at the same time. To do this, Linda specifies modes for individual elements within an XML file. A mode at the element level overrides the global import mode.
Linda creates an XML file that contains both types of products.
<product product-id="T-555361"/> <product product-id="T-367822"/> <product product-id="T-622977"/> <product product-id="T-536378" mode="delete"/> <product product-id="T-638353" mode="delete"/>
She lists new products without an individual mode, and the products to be deleted with the delete mode. Then she runs the import with merge mode. She doesn’t use update mode because it would delete the two products, but not add the new ones.
Linda quickly realizes that the B2C Commerce import/export capabilities are designed to handle storefront data intricacies, such as the type of catalog. This is important because it’s a B2C Commerce best practice to use two catalogs: storefront and master. This is exactly how Cloud Kicks structures their catalogs! The storefront catalog is what they display on their storefront, while the master catalog represents what they import from their external PIM.
Earlier, Linda added and deleted specific products and attributes. She can also import an entire catalog at once. This includes the catalog and any category and product data within it.
With catalog import:
- You can import a storefront catalog independent of the master catalog.
- A storefront catalog category can reference the products in that category.
- Imports of other storefront catalogs don't affect the existing product/category assignments.
- Product update imports of the master catalog don’t affect category assignments in the storefront catalogs.
- The catalog import semantic considers master and storefront catalogs as self-contained data units, isolated from each other, so you can import one without deleting the other’s data structure.
- Business Manager updates the online/offline status based on whether a product is new or existing and the mode that’s used. For example, it automatically sets new products imported in merge and replace modes to offline if you don’t specify the status in the import file.
Linda can export data on selected products from Business Manager or the entire catalog. When Linda uses the Export Specific Products setting, the resulting file only contains a list of selected products and the category assignments for those products.
During export, B2C Commerce automatically trims leading and trailing whitespace and removes any previously saved newline characters in a product image path.
B2C Commerce uses particular object-specific rules when processing imports and exports for object types such as coupons, customers, orders, and price books. Let’s see, for example, how it handles price book imports.
|Mode||Processing Specifics for Price Books|
Linda learned fast that it’s important to consider both the mode and the object type when creating import and export XML files.
In this unit, Linda learned how to use modes for global and element-specific import and export. She also learned that B2C Commerce handles import and export processes relative to the object type. Next, she learns how to configure and run import and export processes.