Sitecore - WFFM : Link contact facet with user profile field

569 views Asked by At

I'm working on a Sitecore 8 Update 2 site. I'm also using the web forms for marketers.

I've set up a login and register form using WFFM. I was able to link fields on the form with the fields of the user profile ( the one used in User Management )

However when i want to make a "Update Contact Details" i can't link the fields on the form with the profile fields as before. Now i have to select a "contact facet". I added one of these and WFFM picked up on this, so now i can link the field on the form with a facet.

The last link i'm missing is linking this facet ( stored in Analytics - MongoDB ) to the profile field.

Does anyone know how to achieve this ?

Bonus: This started off as a slighty different question, you can read more about this issue here: How to update sitecore user with webforms for marketers ( Update Contact Details )

1

There are 1 answers

2
Ian Graham On

First you need to add the Create User Save Action and setup the email address as the username.

Then you need to add the User login Save Action straight after that. This is because the Update Contact Details Save action only applies to logged in users.

Then you can use the Update Contact Details Save Action. This action will create data in MongoDB under the logged in user name - so if you go to the Identifiers collection MongoDB a new entry will be created (See screen shot below).

enter image description here

So in short the aspnet_membership data and the MongoDB data is linked via the username in WFFM. In aspnet_users - UserName and in MongoDB by way of an identifier. You can't mix the MongoDB and aspnet_profile data they belong in two separate places.

So once you have created this user in WFFM you could call up their details using the analytics API using the identifier:

Tracker.Current.Session.Identify(username);
var personalInfo = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal");

Hope that makes sense :)