U4-5797 - Adding properties to a composition DocType after it has been used in content results in new property not working

Created by Hefin Jones 12 Nov 2014, 13:47:40 Updated by Claus Jensen 17 Jan 2017, 07:32:18

Relates to: U4-8763

Relates to: U4-5769

  1. Created a document type called "SEO", added a property of "Title (title)" to the "SEO" document type
  2. Created a document type called "Page", checked "SEO" document type in the "Document Type Compositions" of "Page"
  3. Created a "Page" in the content section - and outputted the Title (on SEO document type) to the browser

This worked as I would expect with the text string outputted to the page using

@Model.Content.GetPropertyValue("title")

However when I went to add an additional property to the "SEO" document type e.g. "Description (description)" and tried to output the text using

@Model.Content.GetPropertyValue("description")

Nothing appeared was outputted to the browser ... and using:

@Model.Content.GetPropertyValue("description").ToString()

Resulted in "Object reference not set to an instance of an object" error

So even though the new property is visible on the "Page" document type in the Content Section - the property doesn't actually work. I can see the property appearing in the umbraco.config file ok,

The only way I've managed to get it to work is to un-assign the "SEO" document type from the "Page" document type and then re-assign - this then makes the property work again - but obviously by doing this the existing content is lost!

Comments

Hefin Jones 05 Jan 2015, 16:25:24

This still seems to be an issue in version 7.2.1 - meaning we would need to get our composition document type properties absolutely correct at the very first attempt as the issue outlined above would stop us from making any amendments to the document type after it's used as a composition - is there a workaround for this or is it expected behaviour?


Chriztian Steinmeier 20 Jan 2015, 08:22:20

I had a really long night trying to render a property that just came out blank (when using Razor). Switched to an XSLT macro this morning (because the property was clearly visible on the Doctype when inspecting with XMLDump) and it just rendered as expected.

The property was created with the alias "telephone" but later renamed to "phone".


Stephan 20 Jan 2015, 09:25:55

I blame poor cache refresh - esp. if I understand correctly that the ppty is in the XML but does not render in Razor (assuming it's MVC Razor and not legacy Razor?). Will try to look into it.


Chriztian Steinmeier 20 Jan 2015, 09:29:31

"Stock" 7.2.1 Razor (MVC, right?)


Stephan 20 Jan 2015, 09:32:15

Yes "stock" is what I call "MVC" ;-) If the value is in the XML document but GetPropertyValue returns null, it means that the content type we use to look for properties does not know that the property exists, ie has not been properly refreshed.

Currently working on fixing events & refreshing for content & content types...


Morten Bock 20 Jan 2015, 12:02:25

I just reproduced this in a clean Fanoe install, and it does seem to be a cache issue. When I touch the web config, then the new content shows up.


Chriztian Steinmeier 20 Jan 2015, 12:33:39

@mortenbock Great, good to know :-)


Peter Gregory 03 Feb 2015, 00:07:50

Just hit this one this morning also.


Peter Holm 25 Feb 2016, 12:35:29

I just hit this one on an Umbraco 7.3.1. Recycling the application pool (touching the web.config) fixed it!


Stephan 07 Mar 2016, 16:12:59

Could not reproduce on 7.4. What I have done:

  • create content type "seo" with property "title"
  • create content type "page" with composition "seo"
  • add GetPropertyValue("title") to "page" template
  • create a "page" document => works
  • edit content type "seo" add property "description"
  • edit "page" template and add GetPropertyValue("description")
  • navigate to document => works

It is that last line which I assume should fail? Is it possible to test again on 7.4 and tell me whether you can replicate?


Stephan 10 Mar 2016, 10:28:42

Proposing to close as "not repro".


Sebastiaan Janssen 10 Mar 2016, 11:04:17

@zpqrtbnk I can still repro, using the steps as described above (SEO tab, create title, publish page with title, add description, publish page with description, @Model.Content.GetPropertyValue("description") doesn't show anything).


Sebastiaan Janssen 10 Mar 2016, 11:05:48

You say:

navigate to document => works

But did you add content in the description property and does it show on the page? Nothing breaks, this is true, but it also doesn't show the description content.


Stephan 10 Mar 2016, 11:36:09

ok, trying again


Stephan 10 Mar 2016, 11:49:03

ok, reproduced


Stephan 10 Mar 2016, 12:02:29

cause: when clearing the published content type cache, we clear the content type that has been modified but do not propagate to composed types, fixing...


Stephan 10 Mar 2016, 13:00:26

PR https://github.com/umbraco/Umbraco-CMS/pull/1164


Sebastiaan Janssen 10 Mar 2016, 13:04:58

yup, that fixes it, thanks!


Nicholas Westby 21 Jul 2016, 17:56:08

Which Umbraco version is this due in? I'm not sure if this fix was applied to 7.4.3, as I'm experiencing the same (or a very similar) issue: http://issues.umbraco.org/issue/U4-8763


Stephan 21 Jul 2016, 18:14:14

The commit in the merged PR is part of 7.4.2. Will look at the other issue.


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.0, 7.4.1

Due in version: 7.4.2

Sprint: Sprint 10

Story Points:

Cycle: