Wednesday 12 February 2014

DateTime fields in custom Page Layouts

This was an interesting problem I came across with SP2013 for which, unfortunately, there doesn't appear to be any real resolution.  So, the scenario is this: you develop a custom Page Layout and set up your content types and columns to use within that Page Layout and decide you need a date/time field in the metadata you'll collect.

You promptly add the DateTime field to your custom Page Layout to capture the information and everything appears to be working fine.  However, if you attempt to Save the page using the normal ribbon Save button you get a "save conflict" error, despite no-one else editing the page (and in my case, no-one else using the system at that time).  I tested this in both SharePoint on-premise and Office365 - and both tests showed the same problem.

After some investigation (many hours of it actually) I found one other lonely developer who had experienced a similar problem and suggested using the alternate Save button which, in SP2013, appears between the ribbon and the Suite Bar on the right-hand side (if you're using a right-to-left reading culture).  This little Save button only appears once you're in Edit mode.  Well, I tried it and surprisingly it worked - no "Save Conflict".  I say "surprisingly" as I would have thought these 2 save buttons would share the same common "save" functionality, but apparently that is not the case at all.  It is a work-around, but not exactly very workable as it means users having to understand when to use that button and when not to, and knowing either not to use the "other" ribbon Save button in certain circumstances or to never use it at all.  Rubbish.

There is also a second/third work-around which may or may not be useful, which is to use the "Check-in" option or do a straight "Publish" (if content approval is set up): both not necessarily ideal, but do get around the issue.

Following several questions put up on the Microsoft partner forums, the MS engineer I was discussing the issue with admitted that there did appear to be an issue which I was very happy about at the time as it mean that I hadn't done something stupid in the Page Layout. 

So, I thought I would post this here in case someone else experiences the same problem and if you do, you can at least have some comfort in the fact that it's not entirely your fault!