5

Activity:

Uploading Contacts in xDB through xConnect by a scheduled task. Number of contacts: 8000+

Environment: Sitecore 9.0.2 XP0 The scheduler is synchronous. The contacts are getting imported successfully.

Environment: Sitecore 9.0.2 XP scaled In the synchronus mode, the logs mention the scheduler as Not due. In the async mode, the entries are made only for around 3800 data

Is it necessary to have it as async? And why my application is breaking there?

Logs:

[Error] Sitecore.XConnect.Operations.AddContactOperation: Sitecore.XConnect.Operations.EntityOperationException: Operation #0, AlreadyExists, Contact
2019-08-08 06:58:56.249 +00:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #1, ReferenceNotFound, Contact, Personal
2019-08-08 06:58:56.249 +00:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #2, ReferenceNotFound, Contact, Emails
2019-08-08 06:58:56.265 +00:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #3, ReferenceNotFound, Contact, Addresses
2019-08-08 06:58:56.265 +00:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #4, ReferenceNotFound, Contact, UserAdditionalInformationFacet
2019-08-08 06:58:56.265 +00:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.EntityOperationException: Operation #0, AlreadyExists, Contact
2019-08-08 06:58:56.296 +00:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #1, ReferenceNotFound, Contact, Personal

3 Answers 3

7

For facets you can't just update over top of them with the same approach as initially setting the facet. You need to check if they exist before that step.If they already exist you need to update the existing facet.

https://doc.sitecore.com/developers/91/sitecore-experience-platform/en/set-contact-facets.html

Note the Update an existing facet on an existing contact section and the example of checking for the facet first then either updating or adding a new one.

 // Retrieve facet by name
 var facet = existingContact.GetFacet<EmailAddressList>(EmailAddressList.DefaultFacetKey);

if (facet != null)
{
    // Change facet properties
    facet.PreferredEmail = new EmailAddress("[email protected]", true);
    facet.PreferredKey = "Work";

    // Set the updated facet
    client.SetFacet(existingContact, EmailAddressList.DefaultFacetKey, facet);
}
else
{
    // Facet is new
    EmailAddressList emails = 
       new EmailAddressList(new EmailAddress("[email protected]", true), "Work");

   client.SetFacet<EmailAddressList>(existingContact, 
       EmailAddressList.DefaultFacetKey, emails);

}

That error is typical of trying to add a facet over top an existing one.

1
  • Thanks for taking out the time. My code is in sync with your suggestion and is working fine for the same data set on XP0. I am sure this is not the case as I am importing those contacts on my local again and again without any issue. Aug 8, 2019 at 10:37
5

The issue was resolved with the hotfix available at https://kb.sitecore.net/articles/397292

Please note that the issue can happen even after processing around 3000 records in one go. This point had caused the doubt before applying this hotfix.

2
  • Make sure to mark this as your answer.
    – mservais
    Aug 8, 2019 at 12:51
  • @mservais: Will do. Right now the system is not allowing me as probably there is 2 days constraint on accepting your own answer. Aug 8, 2019 at 13:12
0

A very similar pattern occurred for me (only difference: only one facet error rather than several as in the OP), and recurred every minute, filling the xConnect logs. I opened a ticket with Sitecore Support; they said this probably indicated a corrupted contact, and I should try clearing the App_Data\Submit Queue folder on the CD instance. That resolved the issue for me.

Your Answer

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

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