November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
So apparently I missed an extra Range Validator on the property, which was causing an extra error, after that I got this new error message :
2018-11-20 11:17:27,172 [75] ERROR EPiServer.DataAbstraction.RuntimeModel.Internal.ContentTypeModelRegister: Detected change of type on property BannerOverride on HomePage. Converting existing content of type EPiServer.SpecializedProperties.PropertyContentArea to new backing type EPiServer.Core.PropertyContentReference is not possible without loss of data. No change is commited.
but this error message only appear a couple of times, but then went back to the orriginal message. Just adding this error message for completeness.
IMHO it would be easiest to remove the old property and create a new one. Or you could just add a validator on the ContentArea that would limit the amount of items that can be added to just 1?
Well the "extra Range Validator" I mentioned was doing excatly that, limiting the ContentArea to a single item, but I think the decision was that the "editor experience" is better with just a ContentReference
I think you may be correct about creating a new property, but obviously removing the old property is not an option (for this thought experiment at least) because perhaps the property already has a value in it? In this instance we dont want to interrupt UAT with this change, so we want it as a seamless experience for editors, without having to tell them they have to re-edit (potentially) hundreds of pages because of a change we've made.
Ah, well... In that case you coud hide the ContentArea in edit mode I guess, and make the view display the ContentArea except when the ContentReference has a value?
I agree with Jeroen, do like this:
1: Create a new property that is a content reference
2: Update the Content Area property to not be visable in the edit mode
3: If you use a view model have the logic to pick the value from the content reference if there is any otherwise pick the content area
4: Create a scheduled task that updates all pages that have a value in content area to be a value for the content ref
Next release
Remove the content area property
Delete the content area property from admin (since it will remain there since there would still be content with value in it)
Remove the extra logic for selecting the correct value.
True this is a lot of extra work but for complex stuff like this there is pretty much no other way and you do not want to have old not used properties in your solution
thanks @Henrik and @Jeroen, from your replies I can tell I'm not missing an obvious solution to this one.
As we are only in UAT at the minute, and the property is not currently in widespread use, so these are the steps I'll be taking...
I've been asked to change a property from a ContentArea into a ContentReference as we no longer need a list but only a sigle item. When I make the change to the code base, and try editting the changed property in the CMS, I get an error message telling me the site is offline when I try to publish (so I cant save or publish the page or anything), and inspecting the logs shows that it is throwing a cast exception:
I can fix this issue by removing the data from the ContentArea before deploying the new property type, but as that could be troublsesome on a large site (this property just so happens to be on EVERY page on the site), what is the recommended way of making this sort of change?