Skip to main content

Understand Import Modes

Learning Objectives

After completing this unit, you’ll be able to:

  • 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 Agentforce Commerce for B2C is designed to handle storefront data.

Introduction

You’re almost ready to use the import/export capability in Business Manager. But before you do, you need to fully understand how modes work. Aside from schemas, modes are the most important aspect of the import/export function.

Compare Modes

While schemas define data file structure rules, modes define what happens to the data at import. This table lists each mode and its function.

With this mode...

This happens...

Merge

If data doesn’t exist, Business Manager adds new data.

If data exists, Business Manager updates existing data.

Update

Business Manager updates existing data but doesn’t 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 aren’t 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 provide the object ID in the XML file. Business Manager ignores the other object attributes.

To see how modes work, consider this scenario: A senior merchandiser asks you to help with product and attribute changes. The merchandiser wants to add a Pinterest flag to a few products as a test. Previously, they tested a Facebook flag and now want to remove that attribute.

You create a table of the changes and decide which mode to use. The changes cover the objects T-123440 to T-123445. In the table, the letters A through F abbreviate the changes to the database. For example, the product T-1234440 is in the database, and the merchandiser wants to add the pinterest-enabled-flag true attribute to it.

A represents the product in the database:

<product product-id="T-123440">

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">

Change: <pinterest-enabled-flag>false</pinterest-enabled-flag>

To: <pinterest-enabled-flag>true</pinterest-enabled-flag>

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

Delete

E

You see that the modes alone don’t support the B1 - Delete attribute change. That is why you still see B, not B1, post import. To remove the Facebook flag attribute, you 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, Business Manager deletes all objects in the import, even if there’s no change.
  • For the update mode, Business Manager doesn’t add new data to the database.
  • For Business Manager to remove objects, add them to the XML file.

One way you delete objects is to create an XML file containing only the objects you want to delete and then import them by using delete mode. The other way is to specify the delete import mode at the object level in the XML feed. We cover that option next.

Modes for Elements

The storefront merchandisers want you to update the catalog with three new products, and delete two products at the same time. For this process, you specify modes for individual elements within an XML file. A mode at the element level overrides the global import mode.

You create 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"/>

You list new products without an individual mode, and the products to delete with the delete mode. Then you run the import with merge mode. You don’t use update mode because it deletes the two products but doesn’t add the new ones.

Manage Catalog Import and Export

The Commerce for B2C import/export capabilities are designed to handle storefront data intricacies, such as the type of catalog. This point is important because it’s a Commerce for B2C best practice to use two catalogs: storefront and product. The storefront catalog is what you show on your storefront, while the product catalog represents what you import from your external PIM.

Catalog Import

Earlier, you added and deleted specific products and attributes. You can also import an entire catalog in a single import. This includes the catalog and any category and product data within it.

With catalog import:

  • You can import a storefront catalog independent of the product 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 product catalog don’t affect category assignments in the storefront catalogs.

The catalog import semantic considers product 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 and 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.

Catalog Export

You export data on selected products or the entire catalog from Business Manager. When you use the Export Specific Products setting, the resulting file only contains a list of selected products and the category assignments for those products.

During export, Commerce for B2C automatically trims leading and trailing whitespace and removes any previously saved newline characters in a product image path.

Object-Specific Processing

Commerce for B2C 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

Merge

  • You can’t change the currency of a price book.

Update

  • After the transaction is committed, Business Manager updates each row in the price book table in one transaction. The transaction makes the new price visible in the storefront.
  • You can’t change the currency of a price book.

Replace

  • After the transfer is complete, Business Manager loads the entire price book in one transaction and shows the new prices on the storefront. If a line item price changes after the price book loads, the new price is visible in the cart as well.
  • You can change the currency of a price book.

Delete

  • When you import a price book, Business Manager deletes the entire price book, instead of just the price assignments of SKUs listed in the XML.

All

  • Price book import ignores price books that contain a negative amount or quantity value. The problem is reported in the import log.
  • Price book import rejects price books with unknown currencies. The system reports a data warning.

It’s important to consider both the mode and the object type when creating import and export XML files.

Next Steps

In this unit, you learned how to use modes for global and element-specific import and export. You also learned that Commerce for B2C handles import and export processes relative to the object type. Next, learn how to configure and run import and export processes.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈