Generic Mapping

The generic mapping capability lets you map keys to values, with the mapping stored in a high-performance data store. This supports large datasets, with high performance for lookup.

For example, you can map SKUs from a backend system to Salesforce B2C Commerce SKUs on-the-fly using B2C Commerce script, so that interaction with the backend system is transparent and doesn't require adding B2C Commerce SKUs to the third party system.

By using generic mapping, B2C Commerce customers can access in-memory key/value pairs that complement product data in the database.

Steps to Use Generic Mapping

Generally, follow these steps to use Generic Mapping:

  1. Create the mapping.
  2. Upload the mapping to the B2C Commerce server
  3. Create a job that uses the ImportKeyValueMapping job step.
  4. Use B2C Commerce script to read values from the mapping.

Create the Mapping

Create a .csv (comma separated value) file to store the mapping. Follow these guidelines:

The format for each line of the .csv file is:

(<key>[,<key2>,…],<value1>[,<value2>,<value3>,...])

The first row of the .csv file defines the property names for the key/value entries. The key/value entries start in row 2. The generic mapping contains one fewer entry than the number of rows in the .csv file. When you call MappingMgr.get(mapping, key), you get a new map with the property names as keys.

If malformed records are encountered, the import fails with an exception that is logged.

Before importing a mapping, upload it to a place accessible by the application server, for example by using a Business Manager upload page or FTP. Mappings must be explicitly imported on each instance. Mappings are global (not site-specific).

Mapping files are limited to 20MB, which is approximately equivalent to 1M records of 20 bytes and a maximum of 20 mappings.

Upload the Mapping

Uploading the mapping makes it accessible.

To upload the .csv file using Business Manager:

  1. Select Administration > Site Development > Import & Export.
  2. Under Import & Export Files, click Upload and select the .csv file.

Alternatively, you can upload the .csv file to the Impex directory using WebDAV or httpClient.

Create a Job

Create a job that uses the ImportKeyValueMapping job step, which transforms .csv files into in-memory key-value mapping and notifies all application servers in a cluster that there is a new mapping. The ImportKeyValueMapping job step supports Replace, Delete, and Merge import modes. For more information, refer to ImportKeyValueMapping Job Step.

Read Values from the Mapping

The dw.util.MappingMgr class, with the following methods, enables you to access mapping data.

See Class MappingMgr for details.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.