Skip to content

Instantly share code, notes, and snippets.

@islaytitans
Last active January 20, 2016 07:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save islaytitans/0404872fab20254b67c9 to your computer and use it in GitHub Desktop.
How to update the Addresses facet in Sitecore xDB
IContactAddresses contactAddresses = contact.GetFacet<IContactAddresses>("Addresses");
if (string.IsNullOrEmpty(contactAddresses.Preferred))
contactAddresses.Preferred = "Shipping Address";
if (!contactAddresses.Entries.Contains("Shipping Address"))
contactAddresses.Entries.Create("Shipping Address");
contactAddresses.Entries["Shipping Address"].StreetLine1 = orderFormModel.AddressLine1;
contactAddresses.Entries["Shipping Address"].StreetLine2 = orderFormModel.AddressLine2;
contactAddresses.Entries["Shipping Address"].City = orderFormModel.CityTown;
contactAddresses.Entries["Shipping Address"].StateProvince = orderFormModel.State.Value;
contactAddresses.Entries["Shipping Address"].Country = orderFormModel.Country.Value;
contactAddresses.Entries["Shipping Address"].PostalCode = OrderFormModel.PostalCode;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment