November Happy Hour will be moved to Thursday December 5th.

IList of Blocks Property stored in database as single Block

Vote:
 

Hi Folks,

I have a property on a page which is an IList of blocks

[Required]
[ListItems(3)]
[Display(Name = "Hero Promo Cards",
    Description = "List of optional Hero Promo Card blocks (min 1 and max 3 can be added)",
    Order = 10)]
public virtual IList<HeroPromoCardBlock>? HeroPromoCards { get; set; }

For some reason this is being read by the CMS as a single block

Have I done something wrong here. I've used the same approach elsewhere in the same project and it works as expected. The only thing I can think of is that this property was originally a content area and changing from that has corrupted the database somehow.  I have reset the content type to code in the settings several times and it is still broken.

#326667
Aug 07, 2024 14:26
Manoj Kumawat - Aug 13, 2024 13:05
It is an issue with content modeling. Try setting EnableModelSyncCommit = true and restart the application to see if it updates. Otherwise, as suggested by other users you should create a separate property with a new name. https://docs.developers.optimizely.com/content-management-system/docs/synchronization
Vote:
 

Was `HeroPromoCards` always a list of blocks, or did the property start out as just a block? Do you have any warnings in the logs during startup of the application and syncing of content types? What happens if you rename the property, does it work then?

#326719
Edited, Aug 08, 2024 8:58
Vote:
 

Hi,

Yeah, I think the most simple way to work around with your problem is changing your property name. There are some cases that property type is not synced from code if the old type is not convertiable to new type if you have some data for that property

#327408
Aug 13, 2024 7:05
Vote:
 

Thanks guys, yeah changing the property name fixed it. We were able to change the name back to the original after wards also and it worked perfectly.

#327543
Aug 15, 2024 14:09
* 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.