Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Error when trying to create a list property with object extending BlockData (CMS 12.29.1/Commerce 14.21.0)



I'm trying to create a simple list property as described in this documentation guide:

I have created the following code on an existing class in the project which is basically the same as the ContactBlock example in the guide:

[ContentType(AvailableInEditMode = false, GUID = "E7F0EB9A-3A55-408B-8FB7-344487C0C27B")]
public class TestBlockData : BlockData
    public virtual string TestField { get; set; }

    GUID =  "D95D7056-4198-452B-9E4E-D315B9D141C6",
    DisplayName = "Dynamic Bundle Product",
    Description = "Provides options for customer to dynamically assemble its own bundle and get discounts for it.")]
public class DynamicBundleProduct2 : ProductContent, IProductRecommendations, IBrownellsContent, IBrownellsSeoProduct,IHideSubscribeToNewsletterContent
    //public override string ClassTypeId { get; }

    [Display(Name = "Bundle Items", GroupName = "Bundles")]
    public virtual IList<TestBlockData> TestListProperty { get; set; }

    //Rest of the class code

And when I start the project I get the following error:

I have tried the following:

  • Changing GUID on both classes
  • Changing main class name
  • Upgrading all Epi packages to latest version

Please advise on possible solutions

May 15, 2024 12:37

When you are uisng this in Commerce item then you need to add Backing type as below

For more information you can see this document here:

Edited, May 15, 2024 15:35

Thanks for the response Praful, but even with using a backing type of PropertyList, it only shows and empty text area, no ability to add items to list or any visible fields from the block:

May 15, 2024 19:15

I am trying to get something like this contact list property which is described in the docs here:

May 15, 2024 19:17

Hi Miroslav,

Something like list of block data works fine in cms content type without new property definition type. Property data type in behind scene for this kind of property is PropertyCollection<T>. And the Editor UI for list works for PropertyCollection<T> and default PropertyList such as string list, int list, date list, not all extended PropertyList<T>.

That is why you do not see editor UI as your expectation. But unlucky there is no MetaDataType mapped to PropertyCollection. So you cannot use backing type of PropertyCollection in Commece. You can look into  PropertyCollectionMetadataExtender code if you want to do some customization for your stuff or you can change to use generic property list like this

May 16, 2024 7:20

Hi Binh, thank you for your reply, after reading a bunch of related blogs I got the feeling also it is only a CMS feature and not for Commerce, I have sent an email to Opti support but I guess now I will just turn it into feature request to add the same functionality to Commerce.

May 16, 2024 10:31

Yeah, it is limitation for Commerce. It is same thing like you cannot create a local block instantly in a content area in Commerce because not allow to create block/content folder under commerce content. Commerce content is from another content provider and cms content is from another content provider. With block list like this, it also needs to create child blocks under commerce content. But it is not possible :)

May 17, 2024 6:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.