How to Update xDB Contacts and Maintain your Sanity

Dmytro Shevchenko
Nov 11, 2017 · 1 min read

There are 4 sets of Contact APIs in Sitecore xDB:

  • ContactRepository
  • ContactManager
  • SharedSessionStateManager
  • Tracker.Current.Contact

Each of them, apart from the ContactManager, has a clear purpose of working with a specific Contact storage. The ContactManager actually works with both the shared session and the Collection database via the underlying APIs, as you can see on the following diagram:

Image for post
Image for post

It’s relatively easy to update contact data via each of these API, provided that you know which one to use.

But what if you just want to update the contact, no matter where it’s currently located? Here’s a method I recently created that will help you:

And here’s how you can use it:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade