Version: Sitecore 9.2
I have followed these tutorials:
- https://himmatsinghdulawat.blogspot.com/2019/06/create-custom-facet-model-in-sitecore-9.html
- How to properly configure a custom facet in Sitecore 9.1
- including Sitecore docs and am not seeing my facet key being saved in xDB.
I have checked and both index worker and automation engine are running.
Here is my implementation:
[Serializable]
[FacetKey(DefaultFacetKey)]
public class ContactFacetExtension : Facet
{
public const string DefaultFacetKey = "ContactExt";
public string Subscribe { get; set; }
public string Unsubscribe { get; set; }
public string Property { get; set; }
}
public class ContactFacetExtModel
{
public static XdbModel Model { get; } = BuildModel();
private static XdbModel BuildModel()
{
XdbModelBuilder modelBuilder = new XdbModelBuilder("ContactFacetExtModel", new XdbModelVersion(0, 1));
modelBuilder.ReferenceModel(Sitecore.XConnect.Collection.Model.CollectionModel.Model);
modelBuilder.DefineFacet<Contact, ContactFacetExtension>(ContactFacetExtension.DefaultFacetKey);
return modelBuilder.BuildModel();
}
}
I have placed this in my
- C:\xconnect root\App_Data\Models &
- C:\xconnect root\App_Data\jobs\continuous\IndexWorker\App_Data\Models
ContactFacetExtModel, 0.1.json
{
"Name": "ContactFacetExtModel",
"Version": "0.1",
"References": [
{
"Name": "XConnect",
"Version": "1.0"
},
{
"Name": "Sitecore.XConnect.Collection.Model",
"Version": "9.0"
}
],
"Types": {
"CustomFacets.ContactFacetExtension": {
"Type": "Facet",
"BaseType": "Sitecore.XConnect.Facet",
"ClrType": "CustomFacets.ContactFacetExtension, CustomFacets, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Properties": {
"Subscribe": {
"Type": "String"
},
"Unsubscribe": {
"Type": "String"
},
"Property": {
"Type": "String"
}
}
}
},
"Facets": [
{
"Target": "Contact",
"Name": "ContactExt",
"Type": "CustomFacets.ContactFacetExtension"
}
]
}
Patches made:
<settings>
<setting name="ListManagement.Import.FacetsToMap">
<patch:attribute name="value">Emails|Personal|Addresses|ContactExt</patch:attribute>
</setting>
</settings>
<xconnect>
<runtime type="Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration">
<schemas hint="list:AddModelConfiguration">
<schema name="contactfacetextmodel" type="Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration" patch:after="schema[@name='collectionmodel']">
<param desc="modeltype">CustomFacets.ContactFacetExtModel, CustomFacets</param>
</schema>
</schemas>
</runtime>
</xconnect>
Is my json.config file not being read? What's the best way to debug this? Not seeing anything relevant in the logs.