Sitecore 9.1

I have a super simple interaction facet that I am trying to push into xDB. Below are the facet, the model, the Json representation that I put into the xConnect Models folder and the client API call.

It does not error as long as I have any kind of an event (my goal) in the interaction. It runs, but it does not save my facet. If I remove the goal/event, it errors since I believe the interaction is empty. Seems like the facet just isn't being added to the interaction before I call the client.

I have gone over this code several times. I just can't see what I am missing.

The issue

When the code below runs, it runs successfully. But I only get the goal in the interaction. The facets are empty. No errors in the logs.

Additional error message for question SEO The type of this instance does not correspond to any type in the model. The type is Client.XdbModels.Facets.SwimEvent.

The facet

    using System;
    using Sitecore.XConnect;

    public class SwimEvent : Facet
        public SwimEvent()

        public const string DefaultFacetKey = "SwimEvent";

        public string PoolId { get; set; }

        public DateTime EventDate { get; set; }

The Model

    using Sitecore.XConnect;
    using Sitecore.XConnect.Schema;
    using Client.Integrations.Swim.Facets;

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

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


            modelBuilder.DefineFacet<Interaction, SwimEvent>(SwimEvent.DefaultFacetKey);

            return modelBuilder.BuildModel();


The model representation

  "Name": "SwimEventModel",
  "Version": "1.0",
  "References": [
      "Name": "XConnect",
      "Version": "1.0"
      "Name": "Sitecore.XConnect.Collection.Model",
      "Version": "9.0"
  "Types": {
    "Usms.Integrations.Swim.Facets.SwimEvent": {
      "Type": "Facet",
      "BaseType": "Sitecore.XConnect.Facet",
      "ClrType": "Client.Integrations.Swim.Facets.SwimEvent, Client.Integrations.Swim, Version=, Culture=neutral, PublicKeyToken=null",
      "Properties": {
        "PoolId": {
          "Type": "String"
        "EventDate": {
          "Type": "DateTime"
  "Facets": [
      "Target": "Interaction",
      "Name": "SwimEvent",
      "Type": "Client.Integrations.Swim.Facets.SwimEvent"

The client call

public async Task AddEvent(string email)
    using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())

                var existingContactTask = client.GetAsync<Sitecore.XConnect.Contact>(new IdentifiedContactReference(Sitecore.Foundation.Accounts.Constants.Strings.UserLoginIdentifier, "[email protected]"), new Sitecore.XConnect.ContactExpandOptions());

                var existingContact = await existingContactTask;

                if (existingContact != null)
                    var channelId = Guid.Parse("7EAA9ED7-188F-40CA-80B9-4439C28386C9");  // Replace with real channel ID
                    var userAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X)";

                    var interaction = new Interaction(existingContact, InteractionInitiator.Contact, channelId, userAgent);

                    var goalID = Guid.Parse("{CFE46AAF-7ECF-456F-8823-A27DF80BDB82}"); // ID of goal item
                    var goal = new Goal(goalID, DateTime.UtcNow) {EngagementValue = 20};

                    client.SetFacet<SwimEvent>(interaction, SwimEvent.DefaultFacetKey, new SwimEvent() { PoolId = "123" });


                    await client.SubmitAsync();
            catch (XdbExecutionException ex)
                // Handle exception
  • Might not be the issue but you need to deploy your json model to two folders in xconnect.
    – JKerny
    Jan 10, 2019 at 22:25
  • 1
    Yup. Xconnect models and indexer models folders.
    – Chris Auer
    Jan 10, 2019 at 22:27

1 Answer 1


I forgot all about the model patch config to tell Sitecore about the model type. Once I patched in this config, I was back in action.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
            <runtime type="Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration">
                <schemas hint="list:AddModelConfiguration">
                    <!-- value of 'name' property must be unique -->
                    <schema name="swimevent" type="Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration" patch:after="schema[@name='collectionmodel']">
                        <param desc="modeltype">Client.Integrations.Swim.Models.SwimEventModel, Client.Integrations.Swim</param>

When you are working outsid

    var collectionClient = new CollectionWebApiClient(new Uri(Constants.XConnectDomain.Url + "/odata"), clientModifiers, new[] { certificateModifier });

    var searchClient = new SearchWebApiClient(new Uri(Constants.XConnectDomain.Url + "/odata"), clientModifiers, new[] { certificateModifier });

    var configurationClient = new ConfigurationWebApiClient(new Uri(Constants.XConnectDomain.Url + "/configuration"), clientModifiers, new[] { certificateModifier });

    XdbModel[] models = { CollectionModel.Model, SwimEventModel.Model };

    var config = new XConnectClientConfiguration(new XdbRuntimeModel(models), collectionClient, searchClient, configurationClient);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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