Sitecore 9: Deleting xDB Contact and Complying with GDPR

Sitecore 9 has perfect documentation ( that answers most possible questions, but it also describes such a nice features so that it is hard not to share them.

And an example of such required for a long time functionality is conformity with PII (Personally identifiable information, laws. That means now we can mark xDB contact information as ‘sensitive’ and remove it when required for GDPR Compliance. And there is no need to run MongoDB queries from console (!

First thing we need is the Sitecore.XConnect.Schema.PIISensitiveAttribute attribute. We can apply it to a Facet or its property:

public class SensitiveInformation : Facet
public string PassportNumber { get; set; }

Second thing is a simple xConnect client method call:

using (XConnectClient client = GetClient())
    IdentifiedContactReference reference = new IdentifiedContactReference(source, identifier);

    Contact contact = client.Get<Contact>(reference, new ContactExpandOptions());


That’s it. xConnect will delete PII sensitive facets, reset sensitive properties values and delete all identifiers. Empty contact will stay in xDB for a data consistency.

Experience profile:

remove xDB contact Sitecore 9 profile

SQL Database:

remove xDB contact Sitecore 9 database

Do you need help with your Sitecore project?