How to Store Custom Data in a User Profile

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The Profiles System is extensible so that it enables you to store custom data in a user profile. Custom data can be anything that relates to a profile, but is not built into the default data store. For example, suppose you want to survey each user through e-mail. However, you want to let a user opt out of e-mail surveying. You could create a custom profile property that is named b_email_survey_opt_out.

Storing custom data in a user profile consists of a multi-step process. This topic outlines these steps.

To create a custom data field in a user profile

  1. Alter the underlying data store to accept the new data value. If you are using the UserObject table in your Commerce Server site data store, you can create the b_email_survey_opt_out field by executing this SQL statement:

    ALTER TABLE dbo.UserObject ADD
    b_email_survey_opt_out bit NULL
    
  2. Use the Commerce Server Manager to map the newly created field to a new profile property. For more information about mapping properties to data sources, see Managing Data Sources.

  3. Edit the appropriate PresentationInfo.xml file for your locale and add the newly created field. Editing this file enables the new field to appear in the Customer and Orders Manager. For more information about the PresentationInfo.xml file and using the Customer and Orders Manager, see How to Make a New Profile Definition Visible in the Customer and Orders Manager.

    Note

    When you customize profiles in the data store, consider the restrictions that apply to the SQL query syntax supported by the OLE DB provider for Commerce Server. For more information about these restrictions, see SQL Queries Supported by the OLE DB Provider for Commerce Server. An important consideration for creating direct mail lists is that all members in WHERE or ORDER_BY clauses must belong to the same underlying table. Direct mail lists are always ordered by e-mail address. Therefore it is best to store all the profile data from which you plan to build direct mail lists in a single table, such as the UserObject table.

See Also

Other Resources

Extending the Profiles System

How to Add a Custom Attribute to a Profile Definition

Customer and Orders Manager

Understanding Commerce Server Configuration

How to Make a New Profile Definition Visible in the Customer and Orders Manager

How to Display a Custom Profile Property in the Customer and Orders Manager