Start tracking your progress
Trailhead Home
Trailhead Home

Understand Your Client's Data Model

Learning Objectives

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

  • Explain the benefit of an accurate data model.
  • List three products types in the Salesforce B2C Commerce data model.
  • List three of the sheets in a data model spreadsheet.
  • Explain how naming conventions work.
  • Explain how data attributes help control application processing.

Introduction

Product data is everything with an online retail storefront. It’s what a merchant presents to the world. It’s the stuff they sell, without which they wouldn’t have a business. That’s why the data model is a critical component of a merchant’s storefront design. It’s used to depict the data landscape that’s necessary to support the storefront solution.

The data model, documented in project documentation such as the functional specification, should reflect the source data systems (or systems of record). Documenting the data model helps organize product data in the context of a database object.

The data model also helps expose the amount of manual data management a merchant must do. It’s best to expose such inherent design considerations early on. If the level of data management work is more than the merchant can handle in day-to-day operations, you need to resolve this gap prior to launch.

Let’s talk about how the merchant data model maps to B2C Commerce, how to create a data model spreadsheet, naming conventions, and data model attributes.

Map to B2C Commerce

Understanding the merchant’s data model makes it easier to map to the B2C Commerce data model, where the storefront products are managed.

The B2C Commerce data model supports the master/variant data relationship where the master is represented by the data object product ID. The master data object has variation attributes, such as size and color. These attributes define how one instance of the product differs from another. In this relationship, a combination of variants represents a purchasable item (the SKU), and the master is the product they belong to.

For example, an apparel retailer sells a Brand-A Flair sweater in different sizes and colors, where size and color are variation attributes of the sweater. In combination, size and color define an orderable item that the shopper buys: gray color, size 14, Brand-A Flair sweater.

B2C Commerce also supports simple products with no variations, product sets (multiple orderable products that are also orderable as a group), and product bundles (a grouping of products that are only orderable as a bundle).

Hanging clothes

Create a Data Model Spreadsheet

It’s essential that you analyze the merchant’s data flow and document their data mapping/model in a comprehensive spreadsheet. Ideally, you only extend the data model if the out-of-the-box Storefront Reference Architecture (SFRA) objects and attributes don’t meet the merchant’s storefront requirements.

Not only does this spreadsheet help you figure out what data the merchant already has and what they need to add, but it also helps define the ongoing import process from the system of record into B2C Commerce. Keeping the products current on the storefront drives sales.

Create the Header Sheet

Let’s start by creating a data mapping spreadsheet with these basic sheets.

  • Catalog-Header (references the following catalog-mapping sheets)
  • Catalog-CategoryMapping
  • Catalog-ProductMapping
  • Catalog-RecommendationMapping
  • PriceBook-Mapping
  • Inventory-Mapping

The Catalog-Header sheet contains the catalog feed ROOT element attributes. Create two columns with rows to collect details on these field name/field ID pairs.

Document Description
Catalog ID catalog-id
Internal B2C Commerce Image Server Base Path base-path
External Image Server HTTP base path http-url
External Image Server HTTPS base path https-ur
Image View Types view-type
Image Variation Attribute ID variation-attribute-id
Alternate Pattern alt-pattern
Tile Pattern image-tile

At the end of the Catalog-Header sheet, reference these sheets.

  • Catalog-CategoryMapping
  • Catalog-ProductMapping
  • Catalog-RecommendationMapping

Create Columns

In the Catalog-Header sheet, create these field columns.

Field Description
Field Name Exactly as configured in Business Manager.
Field ID Exactly as configured in Business Manager.
Source of Data

Data source, such as the following:

  • Product Information Management System
  • Order Management System
  • Entered directly into Business Manager
Pre-Populated Value Yes, if the value comes from the merchant’s feed. No, if the merchant configures this value in Business Manager.
Applicable Field for Client Yes, if this field maps to a back-end system and will be used in the implementation.
Client Table Name If the data origination point is a back-end system, the name of the table containing the data.
Client Field Name If the data origination point is a back-end system, the name of the field within the table containing the data.
Data Type The B2C Commerce attribute type used, for example, string, Boolean, enum of string, or enum of integer.
Update in B2C Commerce Yes, if the data is updatable in B2C Commerce. No, if the data for this attribute is externally managed.
Display on Storefront Yes, if the data will display on the storefront.
Localization Yes, if the data will be localized. Includes the local(s).
Description Describes the purpose of the data and any special criteria, such as valid characters.
Sample Data A sample of the data.
Required Yes, if the data is required. No, if the data is optional.

Create the Other Sheets

Create the other sheets in this spreadsheet, with two columns for attribute name and ID. These are the attribute types, by sheet.

Sheet Attributes Types
Catalog-CategoryMapping Standard Category. Search Ranking, Site Map, SEO, Refinement Definitions, Bucket Definitions, Blocked Bucketed Definitions, Category Assignment (lists)
Catalog-ProductMapping Standard Category, Search Ranking, Site Map, SEO Related, Variants and Custom, Images Group, Custom, Variation, Bundled Products, Product Set products, Options
Catalog-RecommendationMapping Recommendation Elements, Attributes
PriceBook-Mapping PriceBook Header, PriceBook Table Elements, Custom Attributes
Inventory-Mapping Inventory Header (list-id and default-in-stock), Inventory Elements (for example, product-id, allocation, allocation-timestamp, perpetual), Custom Attributes
For each attribute type, create columns for Field Name, Field ID, and the same column headers as for the Catalog-Header sheet. Take a look at the System Objects Types in Business Manager for attribute names and IDs. Make sure you capture all the data attributes.

Naming Conventions

Naming conventions make everyone’s life easier. To simplify the B2C Commerce import process, import feed names should conform to standard naming conventions.

These are examples of the catalog-id (catalog) object.

Naming Convention Example
masterCatalog_<company_name/brand_name> masterCatalog_BeachCloud
siteCatalog_<company_name/brand_name>_<country_code/region_code>

siteCatalog_BeachCloud_US

site Catalog_BeachCloud_EU

Attribute IDs should also follow a naming convention. For example, use camel case to name this attribute: fraudCheckEnabled.

Data Model Attributes

Data attribute types help control how the application processes the data. For example, use integers for product inventory counts, because merchants don’t sell partial products. The money data type (another example) pays close attention to how localized currency is processed.

Attribute Type

This table lists the B2C Commerce supported attribute types.

Naming Convention Description
String Letters, numbers, and punctuation, typically a word or a sentence.
Text Letters, numbers, and punctuation, intended for large amounts of text, such as descriptions.
HTML Intended for HTML tags and values. You can edit HTML attributes in the Business Manager HTML editor. You can’t do this with string or text data types.
Integer A number without decimal places such as 1, 2, 3, or 4.
Number Specify the number of places after the decimal point.
Boolean True or False
Date MM/dd/yyyy
Date + Time MM/dd/yyyy : hh:mm
Image Merchants can select this from the image folder structure. Developers can use a script to dynamically retrieve an image.
Email Business Manager requires a valid syntax for an email address. For example, there must a valid extension after the @ sign.
Money Use when you create a custom attribute for a money value. This data type has localized rules for rounding that cause numbers to provide totals as expected for a specific currency.
Password Displays a masked field and confirmation field for a password. Values are encrypted on export and can be encrypted for import.
Set of String Use for the entry of one or more strings. Sets do not contain duplicates.
Set of Integer (whole numbers) Use for the entry of one or more integers. Sets do not contain duplicates.
Set of Numbers (any numbers) Use for entry of one or more numbers. Sets do not contain duplicates.
Enum of String Use for the selection of one or more values.
Enum of Integer Use for the selection of one or more values.

Attribute Options

For tighter data control, configure attribute options in Business Manager, which vary by attribute type.

  • Mandatory—Must have.
  • Externally Managed—Business Manager users are not allowed to edit the value because it’s fed from a back-end system.
  • Value Unit—The unit of value, such as cm for centimeters or oz for ounces.
  • Minimum Value—Minimum allowed.
  • Maximum Value—Maximum allowed.
  • Scale—Number of decimal places.
  • Field Length—Number of characters.
  • Field Height—Number of lines.
  • Select Multiple—The data can have multiple values.
  • Regex—A regular expression (Java regular expression syntax) to use when validating the attribute. Only for strings.

Next Steps

We discussed mapping the data model to B2C Commerce, creating a data model spreadsheet, naming conventions, and data model attributes. Now let’s talk about specific data model scenarios.

retargeting