• Not Answered

Getting Operation #0, ReferenceNotFound, Contact, Personal while trying to save a contact

Hello Everyone,

I am trying to save a contact in Xdb using the code below but I keep getting this exception : Getting Operation #0, ReferenceNotFound, Contact, Personal

public Sitecore.XConnect.Contact AddNewContact(string email, Dictionary<string, Facet> facets)
        {
            Sitecore.XConnect.Contact contact = new Sitecore.XConnect.Contact(new ContactIdentifier("email", email, ContactIdentifierType.Known));

            using (XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                foreach (var facet in facets)
                {
                    client.SetFacet(contact, facet.Key, facet.Value);
                    //Add LeadId as an identifier if available
                    if (facet.Value is SalesforceData)
                    {
                        SalesforceData salesforceData = facet.Value as SalesforceData;
                        client.AddContactIdentifier(contact, new Sitecore.XConnect.ContactIdentifier("leadId", salesforceData.LeadId, ContactIdentifierType.Known));
                    }
                }

                try
                {
                    client.AddContact(contact);
                    client.Submit();
                }
                catch (XdbExecutionException ex)
                {
                    Sitecore.Diagnostics.Log.Error($"Was not able to save contact {email}", ex,
                        typeof(ContactService));

                    contact = null;
                }
            }

            return contact;
        }

 

Also in XConnect Logs, I have the following entries:

2018-08-07 23:04:37.560 +03:00 [Error] Sitecore.XConnect.Operations.AddContactOperation: Sitecore.XConnect.Operations.EntityOperationException: Operation #0, AlreadyExists, Contact
2018-08-07 23:04:37.560 +03:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #1, ReferenceNotFound, Contact, Personal
2018-08-07 23:04:37.560 +03:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #2, ReferenceNotFound, Contact, Emails
2018-08-07 23:04:37.560 +03:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #3, ReferenceNotFound, Contact, SalesforceData
2018-08-07 23:04:37.560 +03:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.EntityOperationException: Operation #0, AlreadyExists, Contact
2018-08-07 23:04:37.560 +03:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #1, ReferenceNotFound, Contact, Personal
2018-08-07 23:04:37.560 +03:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #2, ReferenceNotFound, Contact, Emails
2018-08-07 23:04:37.561 +03:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #3, ReferenceNotFound, Contact, SalesforceData

Am I doing something wrong here?

 

Thank you in advance!

3 Replies

  • Hi,
    The Tracker uses reference metadata to enrich some of the facets in the contact or interaction
    So Marketeing definition needs to be deployed in the refernce database and tracket uses the reference metadata to enrich the facets in contact.
    So data might not be properly refreshed in reference database
  • In reply to Keerthika Srinivasan:

    I redeployed marketing definition from LaunchPad->Control Panel->Analytics Section-> Deploy marketing Definitions but didn't help.
  • HI,

    I am facing the same issue for my custom facet as you have also listed selaseforceData, I have a facet for CRM and getting the same issue as you mentioned. Were you abble to resolve this ? What was the fix ?

    Thanks,
    Samridhi