Thursday, June 07, 2018

SharePoint 2013 - Column Default Value setting page throws an error after creating new list using existing list template

Column default value settings - Throwing "Sorry Something went wrong" error.

I've tried to adjust 'Column default value settings ' and upon clicking the link in Document Library Settings the familiar error dialog box appears 'Sorry Something went wrong'

I checked the Log and found below error.

System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.  Parameter name: startIndex    at System.String.Substring(Int32 startIndex, Int32 length)     at Microsoft.Office.DocumentManagement.MetadataNavigation.PerLocationViewManager.HumanReadablePath(SPList list, Guid fieldId, String uniqueNodeId, String pathDelimiter)     at Microsoft.Office.Server.WebControls.MetaDataNavTree.TreeViewDataBound(Object sender, EventArgs e)     at System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e)     at Microsoft.Office.DocumentManagement.MetadataNavigation.MetadataNavigationContext.OnTreeViewLoad(SPTreeView spTreeView)     at Microsoft.Office.Server.WebControls.MetaDataNavTree.PerLocationPageLoad()     at Microsoft.Office.DocumentManagement.Pages.ColumnDefa... 1959bd9e-813e-a0e8-05f8-fd58ef93f9c2


...ultsPage.OnLoad(EventArgs e)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 1959bd9e-813e-a0e8-05f8-fd58ef93f9c2

Other libraries in the site collection/ web was working fine. I thought of creating them again manually and dropped the plan since it was having 15000 items in it. I wanted to have a quick solution as it was production.

This seems to happen when you have a library where you have set values for "Column default value settings".  When you then save this library as a template and create a new document library from it, you get the error when you go to"Column default value settings" in the new library. I was doing the same creating new library using existing library which had column default value set. I rechecked the original list and found out that it has Column default setting set. was there any problem when i created new list using template.

To fix, follow below steps:

  1. Open the site in SharePoint Designer 
  2. Go to "All Files".  
  3. Browse to the document library with the error.
  4. Open up the Forms folder.  
  5. In there you will see a file called client_LocationBasedDefaults.html.  
  6. Edit the you will see this file appears to contain the settings for the Column Default Settings, but you will see the url is still pointing to the old doc lib url and so hence why it now errors. just change the URL to new library. (Note: you can delete this file and it will allow to re-create the column default setting, but i recommend to edit the url otherwise you will loose the column default setting)