Use Custom Object Definitions
Use custom object definitions to greatly speed implementation and enable you to take advantage of functionality developed for these objects.
Business objects define the data structure of the catalog and other data used by Salesforce B2C Commerce. B2C Commerce provides a rich library of objects that are designed to address almost all data needed by ecommerce applications. You can also customize your data by creating custom attributes for system objects and custom objects.
Extending objects can help you gather more information from your customers, tailor your storefront site to show more information to the consumer, and enable you to process orders more efficiently, depending upon your back office needs.
Using the System Object Type module you can:
- View all of the system object types
- View all of the attributes defined to a system object
- Edit those attributes including creating new attribute values
- View attribute groupings
- Create new attribute groups
Customize attribute definitions of some system objects to suit your individual site needs. For instance, you can add an additional attribute to the CustomerAddress system object to record an evening phone number or modify custom preferences as custom attributes of the system objects: OrganizationPreferences and SitePreferences (which govern global preferences for all sites and site-specific preferences, respectively).
In addition to adding a customized attribute, you can also choose how to group those attributes through this same module.
Custom preference attributes that have been marked as mandatory can't be updated with empty values in either Business Manager or import.
Extending system objects can help you gather more information from your customers, tailor your storefront site to show more information to the consumer, and enable you to process orders more efficiently, depending upon your back office needs.
Customize attribute definitions of some system objects to suit your individual site needs. For instance, you can add an additional attribute to the CustomerAddress
system object to record an evening phone number.
In addition to adding a customized attribute, you can also choose how to group those attributes.
System objects can be stored globally, which makes the instances available to the entire organization and all sites, or local (per site). The system object type itself is always available to the entire organization.
Custom attributes that have been marked as mandatory can't be updated with empty values in either Business Manager or import.
-
Select Administration > Site Development > System Object Types.
-
On the System Object Type List page, click the name of the object you want to edit.
-
Click the Attribute Definitions tab.
-
On the Attribute Definitions tab, click New to begin the definition process.
-
On the Attribute Definition Details page, enter or select the following information:
-
ID: enter a unique ID for the attribute. We recommend not using alphanumeric characters only for the ID.
You can use the following special characters in the attribute ID:
"+", "-", "$", ".", "%", "§", "&", "*", "#", "/"
. -
Display Name: enter a display name. This is the name shown in Business Manager and in the storefront.
-
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.
Click Apply. Additional fields appear depending on the data type you select.
-
-
Add information for the fields required by the data type you selected and click Apply.
-
Click << Back to see attribute you just created on the Attribute Definitions tab.
You can add custom attributes to custom objects or change property flags for attributes.
-
Select Administration > Site Development > Custom Object Types.
-
On the Custom Object Type List page, click the name of the object you want to edit.
-
Click the Attribute Definitions tab.
-
Click the [attribute name] or the Edit button to edit the attribute.
-
On the Attribute Definition Details page, edit the attributes and click Apply to save your changes.
Salesforce recommends backing up your data before changing the Value Type property. If you change the value type, all data is lost for the attribute. The existing values for the attribute are lost because Salesforce B2C Commerce must create a new, empty attribute and delete the old attribute.
In Business Manager, attributes appear in groups. These groups are system-defined, via the System Object Types module. To show a system attribute, the attribute must belong to a group. Otherwise, it doesn't appear on a page within Business Manager.
This topic provides an example of how to group attributes that appear on the Product details page. The example adds attributes that are specific to digital cameras.
-
Select Administration > Site Development > System Object Types > Product > Attribute Grouping tab.
A list of existing groups appears. You can either create a new group for the attribute, or select an existing group.
-
Create a new group (Digital Camera).
-
In the ID field, enter a group ID (
DigCamera
) -
In the Name field, enter a group name (
Digital Camera
). -
Click Add.
-
-
Click the Edit link for the new group (Digital Camera).
You can see that there are no attributes assigned to this group.
-
Click the ellipsis (...) to access a list of all Product (system object) attributes available to this group. Enter
Digital
in the Search box and click Find. -
Click Select Alland Select.
All available attributes are now assigned to the group.
-
To see the additional attributes, select site > Merchant Tools > Products and Catalogs > Products. Select any product.
-
Click the Attributes tab.
The new attributes (in the new group) are listed toward the bottom of the page.
You can create a new custom attribute of the Product object: to reflect that shoes are made up of multiple materials. The new attribute is named Upper Material.
-
Select Adminstration > Site Development > System Object Types.
-
Select the Product object link and then the Attribute Definitions tab.
Notice the list of attribute definitions already created for this system object.
-
Click New to create a new attribute for this system object.
-
Supply an ID, Name, and Value Type for the new attribute and click Apply. In this case, because we need many string values for the attribute, we select "Enum of Strings" as the value type:
Field Value ID UpMaterial Display Name Upper Material Value Type Set of String 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.
-
In the Attribute Value Range Definition, enter the values, one-by-one and click Apply.
Value Display Value leather Leather vinyl EZ-clean Pseudo Leather cotton Cotton Important: remember to assign the new attribute to an attribute group.
Custom objects enable you to extend the Salesforce B2C Commerce model to suit your business needs.
Custom object types are created for an organization and are then available to use in all storefronts defined for the organization. You can choose, when creating instances of the object, whether to make the instances site-specific or organization-wide.
Custom objects can be stored globally, which makes the instances available to the entire organization and all sites; or locally, that is, per site. The custom object type itself is always available to the entire organization.
Custom object attributes can't be used in search refinement.
You use two Business Manager modules to create and manage custom objects:
- Custom Object Types: Use to create custom object types by selecting Administration > Site Development > Custom Object Types.
- Custom Objects: Use to create custom objects by selecting site > Custom Objects > Custom Object Editor.
Localizable attributes for custom objects are deprecated.
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.
-
Select Administration > Site Development > Custom Object Types to view a table of custom object types.
-
Click New to define a custom object.
-
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.
-
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.
-
Click New to add a new custom attribute or Editto edit an existing attribute.
Localizable attributes for custom objects are deprecated.
-
On the Attribute Definition Details page, enter the following information:
-
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.
-
Display Name: Enter a display name. This is the name shown in Business Manager and in the storefront.
-
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).
-
-
Click << Back, and then click the Attribute Grouping tab.
-
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.
-
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.
-
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:
-
On the Select Object Type Attribute for Custom Object page, select the boxes for the attributes you want and click Add.
-
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.
A custom object is a specific instance of a custom object type.
You must create custom object types before you create custom objects.
-
Select site > Merchant Tools > Custom Objects > Custom Object Editor.
-
On the Manage Custom Objects page, in the Object Type list, select the object definition you want to create a new object for.
-
Click New to create a new object of the type selected.
-
On the New Custom Object page, enter values for any attributes required by the custom object. Click the ? icon beside each attribute for more information.
-
Click Apply to create the object.
You can delete custom objects individually or in a bulk action.
-
Select site > Merchant Tools > Custom Objects > Custom Object Editor.
-
On the Manage Custom Objects page, enter a search string and click Find.
-
Select the box of any object you want to delete.
-
Click Edit All or Edit.
-
On the Process Custom Objects Search Result - Step 1: Select Action page, select Delete Custom Objects and click Next>>.
-
On the Step 2: Delete Custom Objects - Confirmation page, click Finish.
-
On the Batch Processes page, click Refresh.
The Batch Processes page doesn't automatically refresh. You must click Refresh to see a status change.
You can have a custom attribute that is fed directly into Salesforce B2C Commerce from a backend system-of-record.
You can set the externally-managed flag to indicate to Business Manager users that they shouldn't edit these attribute directly. Such an attribute is considered externally managed, because the attribute values are set in an external system. If the feed for an uneditable attribute contains an incorrect value, you can fix the value by deselecting the Externally Managed option and manually fixing it. When the value is fixed, reselect the Externally Managed option.
-
Select Administration > Site Development > Custom Object Types > System Object Types .
The Custom Object Type List page opens or the System Object Type List page opens.
-
Click the name of the object with the attribute that you want to restrict access to.
The Custom Object Types > (custom object) page appears or the System Object Types > (system object) page opens.
-
Click the Attribute Definitions tab.
-
Click the name of the attribute to restrict access to.
You can't restrict access to system attributes, only custom attributes.
-
Select the Externally Managed box.
-
Click Apply.
You can add custom attributes to custom objects or change property flags for attributes.
-
Select Administration > Site Development > Custom Object Types.
-
On the Custom Object Type List page, click the name of the object you want to edit.
-
Click the Attribute Definitions tab.
-
Click the [attribute name] or the Edit button to edit the attribute.
-
On the Attribute Definition Details page, edit the attributes and click Apply to save your changes.
Salesforce recommends backing up your data before changing the Value Type property. If you change the value type, all data is lost for the attribute. The existing values for the attribute are lost because Salesforce B2C Commerce must create a new, empty attribute and delete the old attribute.
You can create custom attributes for system objects or custom objects.
-
Select Administration > Site Development select one of these options:
- System Object Types
- Custom Object Types
-
Click the object name > Attribute Definitions tab and click New.
-
On the Attribute Definition Details page, enter an ID and name for your attribute.
Salesforce recommends including only alphanumeric characters in IDs. IDs must be unique, but names can be duplicates. If an attribute is configured for appear in Business Manager or the storefront, the name appears.
-
Select a data type for the attribute.
The data type controls additional configuration items for the attribute.
-
Click Apply.
Additional fields appear that let you configure how values are managed for the attribute. These fields are different depending on the data type selected.