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 (14)
  1. Bryan K says:

    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?

  2. 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,

    Nihit

  3. Bryan K says:

    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?

    bk

  4. 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…:)

    – Nihit

  5. 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!

  6. Bryan K says:

    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?

  7. Bryan K says:

    Nihit,

    Out of the box there are 5 of those Custom Profile Properties (Data Memberes) to map new user profile properties to.  I am know that I am going to need more than 5 of those.  Could you explain the proper way to add a ‘Custom Property 6’ (u_Pref6) to the Commerce Server Manager User Object and then be able to use it in th Customer and Order Manager.  I tried doing it myself and I got an error when I went to create a new profile in the customer manager with this newly modified profile defintion that had the new custom property tied to a brand new Data Member.  I feel pretty certain that the error was due to me not setting up the new Data Member and then tying it to the new property according to the above post which works fine for an existing data member.  Thanks so much for your time on this.

    bk

  8. Willian Leite says:

    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,

    Willian

  9. Willian Leite says:

    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,

    Willian

  10. Hi Bryan,

    I tried the scenario you mentioned and I also ran into an error…:)

    So then of course I had to figure out what was going wrong since it seemed like a simple enough scenario. Turns out that you need to 3 things and I was missing the 3rd.

    1) From the Profiles MMC in the Data Sources -> Data Objects -> User Object define a new Data Mamber of type String called "FOO".

    2) Then in the Profile Definition for User Object create a new property called "BAR" and map it to "FOO".

    3) Then open the SQL UserObject table and define a nvarchar column called "FOO" corresponding to the Data Member you defined in Step 1.

    Add the property to the presentationInfo file and an IISReset later you should be able to see this in the Customer UI.

    Willian – In your case, I think what you are missing is simply marking the property in the Profile Definition as searchable.

    Hope this helps.

    Nihit

  11. André Nobre says:

    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.

  12. 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,

    Nihit

  13. Gorachand says:

    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")

  14. 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

Comments are closed.

Skip to main content