I am trying to get a sitecore contact with the custom facet. The custom facet is working fine I have verified it. The following code is running fine on Standalone and CM environment, but is throwing error on CD environment.

var contact = client.Get(reference, new ContactExpandOptions(EqActivityFacet.DefaultFacetKey)); var facet = contact.GetFacet<EqActivityFacet>(EqActivityFacet.DefaultFacetKey);

ERROR: The specified type does not match the facet at Sitecore.Xconnect.Entity.GetFacet[TFacet](String name)


You need to perform the below steps to achieve this:

  1. Create a Custom Facet Model
  2. Register the Custom Facet Model Deploy
  3. Custom Facet model to XDB
  4. Add it to the Sitecore.XConnect.Client.Configuration

Please refer below both the blogs and verify if you missed anything.

Create Custom Facet Model in Sitecore 9

Work with Custom Facet in Sitecore 9

Let me know in case you need further help.

| improve this answer | |
  • There is no problem in Contact Facet Model becuase the CM and CD share the same Xconnect environment and it is working fine in CM. I am facing this issue in CD environment. @Himmat Singh Dulawat – Gautam Aneja Apr 7 at 11:44
  • 1
    Sounds like you are missing config files for your facet on the CD server(s). – Chris Auer Apr 7 at 14:59
  • Can you please tell which config files should be added to CD server? @Chris Auer – Gautam Aneja Apr 7 at 16:16
  • 1
    The schema config I reference in my answer below. – Chris Auer Apr 7 at 16:38
  • 2
    Please refer to "Deploy the model to core roles" section in this page, doc.sitecore.com/developers/93/sitecore-experience-platform/en/… – Chris Auer Apr 7 at 17:32

The schema that you specified does not match the JSON that is on xConnect. Have you built the BuildModel correctly?

public class RegistrationDataModel
    public static XdbModel Model { get; } = BuildModel();

    private static XdbModel BuildModel()
        var modelBuilder = new XdbModelBuilder("RegistrationDataModel", new XdbModelVersion(1, 0));


        modelBuilder.DefineFacet<Contact, RegistrationDataFacet>(RegistrationDataFacet.DefaultFacetKey);

        return modelBuilder.BuildModel();


This JSON should match your schema config

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
            <runtime type="Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration">
                <schemas hint="list:AddModelConfiguration">
                    <schema name="registrationdatamodel" type="Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration" patch:after="schema[@name='collectionmodel']">
                        <param desc="modeltype">Sitecore.Feature.Registration.Model.RegistrationDataModel, Sitecore.Feature.Registration</param>
| improve this answer | |
  • everything is fine on CM environment which is using the same XConnect environment but I am facing this issue on CD. models are created correctly. @Chris Auer – Gautam Aneja Apr 6 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.