Import Modes

For import processes, you can specify an import mode to define how to interpret the data within a feed. Some modes aren’t supported for some object types. The import mode, defined for the import process, applies to all objects within the feed. Import modes apply to all import files defined by Salesforce B2C Commerce schemas.

The following table describes general import mode semantics. See Object Type-specific Import and Export topics for nuances and exceptions.

Mode Description
MERGE

MERGE mode means creating an object if it doesn't exist, then performing an UPDATE on the object (see import mode UPDATE).

When creating an object, some object attributes have preset defaults.

UPDATE

UPDATE mode modifies an existing object. The object isn't created if it doesn't exist.

  • Object attributes that are provided in the feed are updated.
  • Object attributes that are not provided in the feed are left untouched.
REPLACE

REPLACE mode means that an object is recreated with the data provided in the feed. The object doesn't have to exist. Existing attributes that are not provided in the feed are removed during the import.

Technically, REPLACE mode equals a DELETE followed by a MERGE.

DELETE DELETE mode means that an object is removed from the database. Only the object ID must be provided in the feed. The other object attributes are ignored.

DELETE mode deletes objects that are in the feed. Likewise, REPLACE import deletes and then re-create objects that are in the feed. Performing a REPLACE import just to change one object deletes the complete object set.

Some imports support an attribute mode at the import element level. In this case, the only supported mode is DELETE, whereby the import mode for the process can be overwritten for a particular element. This is useful when feeding changed information to a B2C Commerce system, whereby allowing a single import process to create, update and delete objects.

Consider this example, where a specific product with product-id PN-00001 is deleted:

<product product-id="PN00001" mode="delete"/>

Salesforce recommends that production feeds are delta feeds that only contain the changes from the previous feed. Delta feeds are smaller to archive, quicker to import, and easier to troubleshoot if an error occurs. However, some schemas have elements that override the global import mode and always use the REPLACE mode. These elements can't be included in delta feeds, as they require the full set of objects to be included in each import feed.

List-Type Elements

The standard behavior for all list-type elements in the XML files is to replace the entire list in the database that is contained in the file, regardless of import mode MERGE or REPLACE.

If the list-element isn't contained in the import file:

  • in MERGE mode, the database list remains
  • in REPLACE mode, the database is deleted