Creating Custom Object Types

⚠️ The annual cost of maintaining the server where this website is hosted, the domain, and keeping it up-to-date is approximately €3,000 per year. Help us with a small donation to cover these expenses. Support Now!

0 / 10000

You create and manage custom object types for additional business objects required by your storefront or business logic to extend the Salesforce B2C Commerce model.

Custom object types must be created in a stage instance, then replicated to production. For example, you could create an object type of 'Sample'. You create the custom object type 'Sample' and then give it attributes, for instance, 'SKU' and 'Date.' Never define custom object types directly in a dev or production instance, because the replication process will remove them. To include custom object types in replication, select the Object Definitions setting in Global Data Replication Settings.

Custom objects can be stored globally (which makes the instances available to the entire organization and all sites), or local (that is, per site). The custom object type itself is always available to the entire organization.

  1. Select Administration > Site Development > Custom Object Types to view a table of custom object types.
  2. Click New to define a custom object.
  3. On the New Custom Object Type page General tab, enter the following information and click Apply.
    • ID: Enter a unique ID for the custom object type. This is the name that you select in Business Manager when you want to create objects of this for the new object type you are defining.
    • Key Attribute: The name of the attribute that is used to provide a unique key for every custom object of this type. The attribute doesn't have to exist when you specify it, but it must exist before any custom objects of this type are created.
    • Data Replication: Select whether you want the custom object to be replicable between instances.
    • Storage Scope: Select whether you want the custom object to be available for the entire organization (all sites) or a specific site.
  4. To create new attributes and assign attributes to the custom object type, click the Attribute Definitions tab.

    You can add or remove object attributes on this page.

  5. Click New to add a new custom attribute or Edit to edit an existing attribute.

    Localizable attributes for custom objects are deprecated.

  6. On the Attribute Definition Details page, enter the following information:
    1. ID: Enter a unique ID for the attribute. The pipe symbol '|' isn't allowed in attribute definition IDs, as it's used internally for versioning purposes. Salesforce recommends using alphanumeric characters only for the ID.
    2. Display Name: Enter a display name. This is the name shown in Business Manager and in the storefront.
    3. Value Type: Select a data type. The data type changes the other configuration options for the attribute once you apply it.
    If you change the language or type, you must confirm the change before it's applied. Changing the language or type of an attribute causes existing values of that attribute to be lost.

    Additional fields appear depending on the data type you selected. Enter the relevant information and click Apply. After you create attributes, you must add the attribute to an Attribute Group in order to manage the custom object through the Business Manager (Custom Object module for the storefront).

  7. Click << Back, and then click the Attribute Grouping tab.
  8. On the Attribute Grouping tab, specify a name and ID for the attribute group and click Add.

    The new attribute group appears in the grid below.

  9. Click the Edit link for the group to add attributes to the group.
    Make sure to add the key attribute you specified on the New Custom Object Type page General tab. Custom objects can't be created for this definition unless the key attribute is included in an attribute group. Don't add the creationDate or lastModified attribute, as these values are automatically supplied by B2C Commerce and don't need to be specified when creating custom objects of this type definition.
  10. On the Custom Object Attribute Definition Assignments page, no attributes are assigned to the group at first. Click the ellipsis ( ... ) to see the attributes that exist for this custom object type:
  11. On the Select Object Type Attribute for Custom Object page, select the boxes for the attributes you want and click Add.
  12. You can sort the attributes in the Custom Object Attribute Definition Assignments Page, to define the order in which the attributes are presented.
    To manage the custom object type that you have just created, use the Custom Objects module under the site area in the Business Manager. See Custom Objects.