Skip to main content
2 of 2
deleted 1 character in body
Adam Seabridge
  • 9.4k
  • 1
  • 33
  • 73

Updating a field Standard Value for Page Data Template without affecting the field value for existing Pages

I have a slightly strange situation where essentially the Standard values for a droptree field have been set incorrectly for quite some time on a number of page templates. The 'Content Type' field should have been set to an empty value instead of an Item Id.

This has resulted in the initial value being set incorrectly for these page items. On some pages content editors have updated the value of 'Content Type' to an different one in the list. On other pages the 'Content Type' has been left 'as is' so it is falling back to the incorrect standard values 'Content Type' value.

I need to fix the initial value set on the standard values for 'Content Type' by setting it to empty (Validation exists on the field to ensure Content editors select a value for this field on page creation so an empty standard value for this field is desired). BUT I need to not affect any existing pages where an 'Content Type' value has not been set.

This is where the problem lies, once I set the 'Content Type' standard value to empty the pages that have had no field value set for 'Content Type' are using the standard value and are therefore showing Empty, instead of the value that was originally set for that page template in the Standard values.

My understanding is that this is how standard values are expected to work, so it's not that they are not working correctly. I think what I actually wanted here was the old school 'Default Values' instead as that would have copied the values of the 'Content Type' field to the pages.

The only solution I can think of for this is to write some SPE to go through every page and check if it has a value set and if not then set it to the standard values value for the page template and then save it. This is less than ideal as it will take some time to test and run. I've written an SPE script to test this and it doesn't seem to work (unless I change the 'Content Type' to different value to the Standard Value 'Content Type') but I'll post a separate question on that if I need to go the SPE route.

Does anyone have any simpler solutions to this issue?

I know there is a 'reset blank' option but I don't think that will help here.

Other info: We are on Sitecore 8.2 update 7.

Adam Seabridge
  • 9.4k
  • 1
  • 33
  • 73