CS 2007: 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.
Comments
Anonymous
August 17, 2006
Isn't there a way to do this through in ionterfaces alone without coding changes. Why do we have to add this to the XML file. It seems if we modify our profile,, we would want to see those changes in the Customer Manager Application.
Is there a way to add a new Profile Definition. Say create a copy of the User Object profile and call it customer and include oall of hte custom cutomer properties?
How does one get this new profile defrinition tol appear int he Customer and Orders Manager?Anonymous
August 17, 2006
Hi Bryan,
I am not sure what you meant by "coding changes"? In the example above we did not do any coding changes. The presentationInfo XML file needs to be updated for localization reasons - the UI has to know what the string for the "Gender" property is in each language.
For displaying a custom profile definition you will need to extend the Customer UI using Partenr SDK which provides the source code for the UI.
Thanks,
NihitAnonymous
August 17, 2006
You're right, I was talking about the XML file and that's not really code. The fact that it is for localization makes perfect sense.
I will look to the partner SDK for extending the Customer UI to add new Profile types. Although, I do think the Customer UI should be smart enough to pick up new profile definitions set in commerce server manager.
Thank you for the prompt reply! I am working on a new project for a client that is using CS 2007 and we are implementing a lot of custom features like profiles and campaigns, etc.
I may try to contact you in the future with new issues if that's OK. Do you have a lot of experience with CS 2007 already?
bkAnonymous
August 17, 2006
Hi Bryan,
I would prefer if you use the Newsgroups to ask any questions that might come up during your projects. That will be much faster and allow a lot of different area experts to respond.
As far experience with CS 2007 goes - I guess I need to have that as part of my job description since I was part of the CS 2007 testing team...:)
- NihitAnonymous
August 17, 2006
Now that the Commerce Server development team has shipped their flagship product, they've started to publish some great new posts about using Commerce Server 2007. If you don't already subscribe to these blogs, you really should!Anonymous
August 18, 2006
Ah. Didn't realize that about your job description :) Where do you think I could find some of the better all around Commerce Server 2007 blogs?Anonymous
August 18, 2006
The comment has been removedAnonymous
August 18, 2006
Can I find in Commerce Server Manager any tool to export the PresentationInfo Xml?
I have a lot of custom profiles and properties and write those XML everytime that a change something will bring a lot work.
Thanks,
WillianAnonymous
August 18, 2006
Reading your post and I belive that I misunderstood the utilization of that.
I'm using the GetSearchableEntities from ProfileManagementContext and my new Profile Defitions are not returned in the DataSet.
That's any relation this with the PresentationInfo Xml? If not why the Profile Definitions are not returned?
Thanks,
WillianAnonymous
August 18, 2006
The comment has been removedAnonymous
August 19, 2006
Hi Nihit,
I am working with Willian on Commerce Server 2007. Our problem isn´t about custom properties, but in custom Profiles. We created a custom profile "OptIn", and the GetSearchableEntities() does not returns this new profile as searchable one.
Anything wrong?
Thanks.Anonymous
August 21, 2006
Hi Andre,
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.
Thanks,
NihitAnonymous
December 13, 2006
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")Anonymous
January 03, 2007
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