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:
I have create a new profile "TestProfile" defination and I followed the steps u have mentioned.
But the "TestProfile" not appearing in the Customer and Orders Manager UI.
Note : I have created table, datasource, dataobject, data memeber through commerceserver manager.
Through web application when I am trying the following code it showing "Type missmatch error" inner exception.
dim strGuid as string
dim objmyProfile as profile
dim objProfileContext as profileContext
strguid=Guid.NewGuid().ToString()
objProfileContext=CommerceContext.Current.ProfileSystem
ObjmyProfile=objProfileContext.createprofile(strguid,"TestAddress")
Hi,
Sorry for the delayed response, I was OOF on vacation.
I would suggest you post your error details and code snippet on the MSDN Commerce Server forums and someone should be able to help you out with this issue.
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1059&SiteID=1
Thanks,
Nihit