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

Vote:
 

Hello,

I'm trying to create a simple list property as described in this documentation guide: https://docs.developers.optimizely.com/content-management-system/docs/property-value-list

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; }
}

[CatalogContentType( 
    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

#322080
May 15, 2024 12:37
Vote:
 

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:

https://docs.developers.optimizely.com/content-management-system/docs/property-attributes#default-backing-types

#322083
Edited, May 15, 2024 15:35
Vote:
 

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:

#322099
May 15, 2024 19:15
Vote:
 

I am trying to get something like this contact list property which is described in the docs here: https://docs.developers.optimizely.com/content-management-system/docs/property-value-list

#322101
May 15, 2024 19:17
Vote:
 

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 https://docs.developers.optimizely.com/content-management-system/docs/generic-propertylist

#322143
May 16, 2024 7:20
Vote:
 

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.

#322145
May 16, 2024 10:31
Vote:
 

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 :)

#322274
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.