1

In my Sitecore application, I've created custom facet (it has simple fields and object lists). I identify the user by the method:

  try
  {
    if (Tracker.IsActive)
    {
      Tracker.Current.Session.Identify(userId);
      Tracker.Current.Contact.ContactSaveMode = Analytics.Model.ContactSaveMode.AlwaysSave;
    }
  }

Sometimes, when it is called, an error occurs:

ERROR The given key was not present in the dictionary. RROR at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Sitecore.Analytics.Model.Framework.ModelUtilities.CopyElement(IElement source, IElement destination) at Sitecore.Analytics.Pipelines.MergeContacts.MergeContactFacets.Process(MergeContactArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Analytics.Pipelines.MergeContacts.MergeContactPipeline.Run(MergeContactArgs args) at Sitecore.Analytics.Data.ContactRepository.MergeContacts(Contact survivingContact, Contact dyingContact) at Sitecore.Analytics.Tracking.StandardSession.Identify(String userName)

Do you know what this is caused by? The facet is added in the configuration and the data is put away (they are used in xDB conditions)

  • Can you find the contact with your userId in mongo (e.g. using robomongo) and see all its facets? It looks like during the merge, whatever is there in the source cannot be copied to the target. Do you use your mongo for multiple instances? – Marek Musielak Feb 7 '18 at 9:04
  • Contact exist in mongoDB. I have one instance of mongo, but application have one CM and two CD. – Jan Nowak Feb 7 '18 at 9:39
  • Do you have the same facets on both CM and CD? – Marek Musielak Feb 7 '18 at 11:05
  • User identification is only on CD servers, but configured in config files are here and here. CD and CM use the same mongoDB database – Jan Nowak Feb 7 '18 at 11:26
  • Sitecore version? – Marco Feb 8 '18 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.