Adrian Iorgu
Adrian Iorgu

Reputation: 611

Exception in log: Analytics root item should exist in the database. Source: Sitecore.Marketing

After upgrading a 6.5 Sitecore solution to 8.1, starting with clean 8.1 databases and migrating the items from old solution, I am getting an exception in the logs complaining about Analytics root item missing. Checked in Sitecore and the Marketing Center and the 8.1 specific items exist. Any clue that is causing this exception? Thank you in advance!

Message: analytics root item should exist in the database

Source: Sitecore.Marketing at Sitecore.Marketing.Definitions.Outcomes.Data.ItemDb.ItemOutcomeDefinitionRepository..ctor(String databaseName, Boolean assumeActive, IDefinitionRecordMapper`1 mapper) at Sitecore.Marketing.Definitions.Outcomes.Data.ItemDb.ItemOutcomeDefinitionRepository..ctor(String databaseName, Boolean assumeActive)

Upvotes: 2

Views: 433

Answers (1)

Vlad Iobagiu
Vlad Iobagiu

Reputation: 4118

This error is comming from:

  public ItemOutcomeDefinitionRepository(string databaseName, bool assumeActive, IDefinitionRecordMapper<OutcomeDefinitionRecord> mapper)
  : base(Assert.ResultNotNull<Database>(Database.GetDatabase(databaseName), "database not found " + databaseName), ItemOutcomeDefinitionRepository.OutcomeTemplateId, ItemOutcomeDefinitionRepository.OutcomeContainerId, assumeActive, mapper)
{
  Assert.ArgumentNotNull((object) databaseName, "databaseName");
  Assert.ArgumentNotNull((object) mapper, "mapper");
  this.itemDb = Assert.ResultNotNull<Database>(Database.GetDatabase(databaseName), "database not found " + databaseName);
  Assert.IsNotNull((object) this.itemDb, "item database '{0}' should be available", (object) databaseName);
  Assert.IsNotNull((object) this.itemDb.GetItem(ItemOutcomeDefinitionRepository.OutcomeContainerId), "analytics root item should exist in the database");
}

Exception is thrown by this line :

 Assert.IsNotNull((object) this.itemDb.GetItem(ItemOutcomeDefinitionRepository.OutcomeContainerId), "analytics root item should exist in the database");

You need to check if you have item with id:

 private static readonly ID OutcomeContainerId = Sitecore.Marketing.Definitions.Outcomes.WellKnownIdentifiers.MarketingCenterOutcomeContainerId;
  public static readonly ID MarketingCenterOutcomeContainerId = ID.Parse("{062A1E69-0BF6-4D6D-AC4F-C11D0F7DC1E1}");

The item with above id is the item with path:

/sitecore/system/Marketing Control Panel/Outcomes

Upvotes: 1

Related Questions