I have to add some new property on the commerce customer's profile of a commerce 8.2.1 solution. I don't have any particular external integration needs. All the user's data can be stored in sitecore/sitecore commerce, the only needs I have is to keep the editing support of the user manager.
Before posting I followed this guide from version 8.1: http://commercesdn.sitecore.net/SCpbCS81/SitecoreCommerceConnectGuide/en-us/#Concepts/c_ProfileStoreFundamentals.html
Hovewer I found some issues:
- If I set a datatype other than string in the web.config, I get an exception at runtime
- If I set the datatype as string, linked to an item via droplink (so It would be stored as a string Guid), I can edit the field from sitecore and it stores the field successfully, but when I try to set the same field via code, the field is left blank
- If the field is a datatype string type, but a simple single line instead of a link to an item, I'm able to save the data into it the same way I do (that not work), for the linked field.
To set the custom user field via code I do the following (assume that user is a valid CommerceUser object):
var userProfile = User.FromName(user.UserName, true).Profile; userProfile.SetCustomProperty(propertyName, propertyValue); userProfile.Save();
Am I skipping some steps or doing something wrong?