I am working on display facet data on the Experience profile tab. I am following the below article for the same.
http://zhenyuan.azurewebsites.net/post/displaying-custom-facets-in-contact-profile
But when I am hitting my custom tab, debugger comes to defined routes (Controller and Action) which I registered and successfully returns the Custom Facts data, but unfortunately, it's throwing me below different error's on the console:
(1) ExceptionMessage: "The 'ObjectContent'1' type failed to serialize the
response body for content type 'application/json; charset=utf-8'."
(2) Exception Newtonsoft.Json.JsonSerializationException: Self referencing loop detected with type 'Sitecore.XConnect.Schema.XdbProperty'. Path 'XObject[0].Key.DeclaringType.DeclaredProperties'.
URL which executes on custom tab click is:
http://helixbase.sc/sitecore/api/ao/v1/contacts/a2c0c034-c6f9-0000-0000-058b1d973da1/customformfields/
If I execute this URL in the seperate tab then it returns me value as below:
{"k__BackingField":"Prince Sharma","k__BackingField":"[email protected]","k__BackingField":"9654477778","k__BackingField":"Sharma","k__BackingField":"PAS34567NUM890","k__BackingField":"Hindi","k__BackingField":"10b430b2-a9c1-463b-be1e-315af66fdbde","k__BackingField":"2019-04-25T11:05:16.7443003Z","k__BackingField":true}
JS File
define(["sitecore", "/-/speak/v1/experienceprofile/DataProviderHelper.js",
"/-/speak/v1/experienceprofile/CintelUtl.js"],
function (sc, providerHelper, cintelUtil) {
var app = sc.Definitions.App.extend({
initialized: function () {
var localUrl = "/customformfields/";
providerHelper.setupHeaders([
{ urlKey: localUrl }
]);
//providerHelper.addDefaultTransformerKey();
var url = sc.Contact.baseUrl + localUrl;
var $that = this;
providerHelper.initProvider(this.customDataProvider, "", url, this.customTabMessageBar);
providerHelper.getData(this.customDataProvider,
$.proxy(function (jsondata) {
cintelUtil.setText($that.SurNameValue, jsondata.SurName, true);
cintelUtil.setText($that.PassportValue, jsondata.PassportNumber, true);
}));
}
});
return app;
});
Rest of the Controller, Action, InitializeRoutes code
I implemented the same as an above-defined article. Thanks.