How to Change the Profiles Primary Key
By default, Commerce Server Core Systems stores Profiles data by using the email_address field as the primary key. Your business scenario may dictate that another field, such as logon_name, be the primary key. This topic outlines the steps that are required to change this default behavior, by using the starter site as an example. Follow all procedures in the order listed:
Change the Profiles System primary key.
Update the starter site configuration (if you are using the starter site).
Update the starter site Web pages (if you are using the starter site).
Update the Customer and Orders Manager tool.
Note
To perform the steps outlined in this procedure, you must first install the Commerce Server Core Systems SDK. For more information about how to install the SDK, see the installation guide. By default, the SDK is installed in the C:\Program Files\Microsoft Commerce Server 2007\SDK folder.
Warning
Running the scripts in this procedure will delete all Profiles objects and tables. Therefore, make sure that you back them up before following this procedure.
To change the Profiles System primary key to use logon_name
Open Microsoft SQL Server Management Studio and execute the following SQL script:
profilesql_nonemaillogonname.sql
By default, this is located in the C:\Program Files\Microsoft Commerce Server 2007\sdk\Samples\Profiles folder.
Import the Profilesql_nonemaillogonname.xml profile schema file. By default, this is located in the C:\Program Files\Microsoft Commerce Server 2007\sdk\Samples\Profiles folder. For information about how to import profile schema, see How to Import Profile Schema.
To update the Customer and Orders Manager tool
Locate the four *_presentationinfo_nonemaillogonname.xml files. By default, these are installed in the C:\Program Files\Microsoft Commerce Server 2007\sdk\Samples\Profiles folder. Each file is for a different culture; EN, DE, FR, and JA.
Copy the four files into the Profiles Web Service folder. By default this is C:\inetpub\wwwroot\ProfilesWebService.
Open the Profiles Web Service Web.config file by using Visual Studio or a text editor.
Change each of the <cultureConfig> elements in the <presentationConfiguration> section to point to the new presentation information file you copied in step 2, as follows:
<presentationConfiguration> <cultureConfig filePath="en_PresentationInfo_NonEmailLogonName.xml" isDefault="true"/> <cultureConfig filePath="de_PresentationInfo_NonEmailLogonName.xml"/> <cultureConfig filePath="fr_PresentationInfo_NonEmailLogonName.xml"/> <cultureConfig filePath="ja_PresentationInfo_NonEmailLogonName.xml"/> </presentationConfiguration>
Save and close the Web.config file.
Robust Programming
The procedure outlined in this topic shows how you can change the default Profiles System primary key from email_address to logon_name. However, you may have to change the primary key to a different field, such as tel_number. To do this, you must follow the same procedure as the one outlined in this topic, but you will have to modify the scripts and procedures shown in this topic.
Security
You must have permissions to execute SQL scripts and to import profile schema.