Versioning Presentation Details in Sitecore 7.2


The Back Story

One really big we have had using Sitecore at my work has always been that presentation details do not go through any workflow. The way things are set up is that all content is assigned some sort of workflow that includes multiple pre-production preview sites so that content changes can be scrutinized before they are approved by those select few that have the access to allow changes to go live. We also have an auto-publish agent that does an incremental publish every one minute (I know...crazy right?) so that once a change is approved it is almost immediately published to the live content delivery sites. Needless to say any updates to unversioned or shared fields, like the __Renderings field that stores presentation details, is a very scary endeavor for us. I have been on more than a few outage bridges for multiple hours explaining to executives why major landing pages on the site "just didn't look right."
We have brought this issue up with Sitecore so many times I lost count. This year at Symposium I also think I brought it up to a few different speakers but when I mentioned it to Tim Ward I got the most enthusiastic reply of "I know this issue!!! I can help you!!"

Disclaimers

I only tried this after I got confirmation this should work from Sitecore product engineering. Also the statement "I wanted to be prioritized in the platform for about a year but only snuck in at 7.2" would suggest that these steps very likely will not work in any earlier version of Sitecore, so I did not even try. Also, I offer no warranty here, I am only posting about my experiences and at the point in time that I am writing about this, this has not been used in a production environment.
Now, without further ado........The steps I took to get presentation details to go through workflow and be versioned!!

Let's Do It!!!!

Create a Rollback Plan
There is really very little manual work that you will do to turn this on but don't be fooled. A lot of things are happening and I can think of more than a few things that can get you in a really bad place so at the very minimum back up your databases.
Content Freeze/Lock Out
There is going to be an agent that is moving all kinds of data around in your databases. What will be happening is very similar to doing a Sitecore upgrade so do not risk any content authors logging in and making changes while this is happening. The more isolated an environment you can create for this the better.
Disable All Publishing Agents
You need have complete control here so make sure the Master database is completely stable before anything gets published.
Change The __Renderings Field of the Layout Template
Find the item with the ID of {F1A1FE9E-A60C-4DDB-A3A0-BB5B29FE732E}. It will be at the path /sitecore/templates/System/Templates/Sections/Layout/Layout/__Renderings. Under the Data section find the field called "Shared" and uncheck the check box. Then hit save.

You will then prompted with the following warning:
After you say okay, the crazy starts.  There is a job that is started in Sitecore that moves the all the presentation data values form the table [SharedFields] to the [VersionedFields].  Keep in mind that Sitecore database actions are non-transactional so think about all the things that can go wrong here.
  1. Reads the first item it finds with the __Renderings field that is in the [SharedFields] table.
  2. Adds a record for each distinct combination of language and version for the item.
  3. Delete the data from the [SharedFields] table.
  4. Repeat until all the items are updated.

And your are there. Welcome to a world of versioned presentation components.

The Gottcha
I've banged on this for a while, reviewing logs, testing page editor and content editor, I even wrote a test script to simulate load. Everything seems fine. So this seems so simple and too good to be true, right? So here is the kicker. In my email communication with Tim Ward there was this: "you will need to make sure that when you move to 8.0 at some point that you UNDO this check." What happens when you do that is not pretty and I can't think of a way it could be. The very nature of taking a versioned field and converting it into shared field implies data loss. Which version, which language do you use for the data. What you will see is it will always take the last updated version/language, even if it is not in a publishable state. What should it do? I really have no idea.
Conclusion
First off Sitecore has been great helping me through this. Every question I asked was answered, every issue I faced had a proposed solution that they were willing to walk me through. Also I'd like to point out that Sitecore set up Presentation details as a shared field by design. It is not a defect (I've heard people claim that). If you can wait for Sitecore 8.0 they have a very elegant solution for this that is explained well in this blog post by Sean Holmesby. It is also possible that as people get their hands on Sitecore 8.0 that someone may back port this back to older versions of Sitecore. Now nowing all this if you can't wait and you are willing to deal with issues in the upgrade path in the future, this option is for you..
No comments

No comments :

Post a Comment