How to display a custom user profile definition in the Customer and Orders Manager?
This was a question recently posted on one of the Commerce Server newsgroups and I thought I’d write a post on it since it seems like it should be of interest to others as well. In this post I shall give a step-by-step overview of how to create a custom property on a User Object Profile and how to view and edit that property in the Customer and Orders Manager UI shipped as part of Commerce Server 2007.
1) First let’s create a custom property, say “Gender” on the default out of the box User Profile definition.
a. Open the Commerce Server Manager MMC and browse to the Profiles global resource for your site.
b. Go to Profile Catalog à Profile Definitions à User Object and click on the “General Information” group and then the “Add” button to define a new property in this group.
c. Expand the Advanced section and in the “Map to data” click on the browse (…) button and select ProfileService_SQLSource à User Object à Custom Property 1.
d. Click on Apply and then click the Save button in the Toolbar to save this User Object profile definition.
Here is a screenshot of the user object profile definition with the custom property defined:
2) Next we will modify the PresentationInfo files to add the display information.
a. Browse to the file system directory where the Profiles web service for your site points to and open the en_PresentationInfo.xml file in an editor.
b. Browse to the <profile> section and under the <displayArea> node any a <property> element for the newly defined “Gender” property from step 1.
c. Save the XML file and repeat steps 2a and 2b for all language presentation info XML files you wish to launch the UI in.
Here is a what the XML with the <property> node added for the Gender property will look like:
<profile name="UserObject" displayName="User Object" description="User Object">
<displayArea name="main" displayName="Main">
<property name="Gender" displayName="Gender" description="Property to track Gender of user"/>
3) Lastly you will have to do an IISReset and then refresh the Customer and Orders Manager UI. Now when you open an existing user object or create a new one, you should see the Gender property show up on the Edit dialog. Here is a screenshot showing the Gender property on the new user object dialog:
Update: Thought it worthwhile to add a note that if you are trying this scenario with a custom profile definition (as the blog post claims it to be!) instead of simply some custom properties on the out-of-the-box User Object profile definition, then you need to ensure a couple of additional things as follows:
1) You need to have at least one property in the profile marked as searchable.
2) You need to create a scope for this particular custom profile. You can do so by running the CreateProfilesAuthorizationStore.exe tool in %Commerce_Server_Root%\Tools folder and give it the name of your site and the Profiles auth policy file.