Posts

Showing posts from March, 2024

“An item with the same key has already been added. Key: PageDescription”

Image
  “An item with the same key has already been added. Key: PageDescription ” System.ArgumentException: at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Collections.Generic.Dictionary`2.TryInsert (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Mediachase.MetaDataPlus.Configurator.MetaObjectDB.LoadMetaObjectData (Mediachase.MetaDataPlus, Version=14.15.2.0, Culture=neutral, PublicKeyToken=41d2e7a615ba286c) at Mediachase.MetaDataPlus.Internal.CatalogMetaObjectRepository.DoLoadFromDb (Mediachase.MetaDataPlus, Version=14.15.2.0, Culture=neutral, PublicKeyToken=41d2e7a615ba286c) We could use this query to find the content that caused the error: SELECT TOP(1000) ObjectId, MetaFieldName, COUNT(*) AS Count FROM [dbo].[CatalogContentProperty] Where MetaFieldName = ' PageDescription ' GROUP BY ObjectId, MetaFie...

Remove metafield from product content

Even when you remove the code of the  meta field from product content ,  it's still there in the database.  So we need the scripts to complete removing them in both Commerce and CMS: For Commerce: DECLARE @MetaFieldId INT = 80  DELETE FROM MetaDictionary WHERE MetaFieldId = @MetaFieldId  DELETE FROM CatalogContentProperty WHERE MetaFieldId = @MetaFieldId  DELETE FROM ecfVersionProperty WHERE MetaFieldId = @MetaFieldId  DELETE FROM MetaClassMetaFieldRelation WHERE MetaFieldId = @MetaFieldId  DELETE FROM MetaField WHERE MetaFieldId = @MetaFieldId  EXEC mdpsp_sys_ClearMetaAttribute @MetaFieldId, 2 For CMS: exec netPropertyDefinitionDelete @PropertyDefinitionID=2699     If the meta field is not completely removed, the meta field will be re-creating/re-appearing in `tblPropertyDefinition` in CMS when you restart the site: declare @p1 int  set @p1=2702  declare @p16 int  set @p16=7  declare @p17 int  set @p17=NULL...