How to update sitecore user with webforms for mark

2019-09-06 03:23发布

问题:

I'm working on a Sitecore 8 Update 2 site. I used web forms for marketers to create a login and register page. These worked fine and were easy to use. On the register form i was able to link fields on the form with fields on the selected user profile, nice and easy.

Now i want a page were user can edit their contact data. However when i want to link the fields of the form I can only link them to facets. I have filled in the " User Profile " field of the form with my profile. So i would like to link these fields just as a register form does.

Is there any way to achieve this ?

回答1:

If you want to update contact data you will have to update facets using the Update Contact Details Save Action - this is how xDB works and exerything is a facet. Each bit of information in xDB needs to be updated via a facet e.g. the Personal Info Facet

 var personalInfo = Tracker.Current.Contact.GetFacet<Sitecore.Analytics.Model.Entities.IContactPerso‌​nalInfo>("Personal"); 
 personalInfo.FirstName =firstname; 
 personalInfo.Surname = surname;

To register custom facets there's a good post here:

http://www.sitecore.net/learn/blogs/technical-blogs/getting-to-know-sitecore/posts/2014/09/introducing-contact-facets.aspx



回答2:

See the pictures below how you need to configure this. The Create User save action needs to be configured to update user account and profile. NOTE the password field. You cannot change that this way. To change the password there is another action.

The Update Contact Details save action will update the XDB contact.

Screencast pictures



回答3:

Basically, what you need is to use out-of-the-box "Update Contact Details" Save Action on your form, which will allow you to bind form fields to your contact's facets.

I have blogged a solution for this recently! Check this post for more details: https://broair.wordpress.com/2016/08/17/wffm-associate-form-fields-with-xdb-contact-facets/