Restoring a page causes an error: "Caused exception: Cannot insert the value NULL into column 'Docu

Gabe R asked on November 7, 2018 19:22

Trying to restore a deleted page, but I'm getting this error about DocumentInheritsStylesheet not accepting null values:

EventID: 48663458

EventType: E

EventTime: 11/7/2018 1:02:36 PM

Source: Content

EventCode: RESTOREDOC

EventDescription: Message: 
[DataConnection.HandleError]: 

Query: 
INSERT INTO CMS_Document ([DocumentName], [DocumentNamePath], [DocumentModifiedWhen], [DocumentModifiedByUserID], [DocumentForeignKeyValue], [DocumentCreatedByUserID], [DocumentCreatedWhen], [DocumentCheckedOutByUserID], [DocumentCheckedOutWhen], [DocumentCheckedOutVersionHistoryID], [DocumentPublishedVersionHistoryID], [DocumentWorkflowStepID], [DocumentPublishFrom], [DocumentPublishTo], [DocumentUrlPath], [DocumentCulture], [DocumentNodeID], [DocumentPageTitle], [DocumentPageKeyWords], [DocumentPageDescription], [DocumentShowInSiteMap], [DocumentMenuItemHideInNavigation], [DocumentMenuCaption], [DocumentMenuStyle], [DocumentMenuItemImage], [DocumentMenuItemLeftImage], [DocumentMenuItemRightImage], [DocumentPageTemplateID], [DocumentMenuJavascript], [DocumentMenuRedirectUrl], [DocumentUseNamePathForUrlPath], [DocumentStylesheetID], [DocumentContent], [DocumentMenuClass], [DocumentMenuStyleHighlighted], [DocumentMenuClassHighlighted], [DocumentMenuItemImageHighlighted], [DocumentMenuItemLeftImageHighlighted], [DocumentMenuItemRightImageHighlighted], [DocumentMenuItemInactive], [DocumentCustomData], [DocumentExtensions], [DocumentTags], [DocumentTagGroupID], [DocumentWildcardRule], [DocumentWebParts], [DocumentRatingValue], [DocumentRatings], [DocumentPriority], [DocumentType], [DocumentLastPublished], [DocumentUseCustomExtensions], [DocumentGroupWebParts], [DocumentCheckedOutAutomatically], [DocumentTrackConversionName], [DocumentConversionValue], [DocumentSearchExcluded], [DocumentLastVersionNumber], [DocumentIsArchived], [DocumentHash], [DocumentLogVisitActivity], [DocumentGUID], [DocumentWorkflowCycleGUID], [DocumentSitemapSettings], [DocumentIsWaitingForTranslation], [DocumentSKUName], [DocumentSKUDescription], [DocumentSKUShortDescription], [DocumentWorkflowActionStatus], [DocumentMenuRedirectToFirstChild], [DocumentInheritsStylesheet], [DocumentCanBePublished]) 
VALUES (@DocumentName, @DocumentNamePath, @DocumentModifiedWhen, @DocumentModifiedByUserID, @DocumentForeignKeyValue, @DocumentCreatedByUserID, @DocumentCreatedWhen, @DocumentCheckedOutByUserID, @DocumentCheckedOutWhen, @DocumentCheckedOutVersionHistoryID, @DocumentPublishedVersionHistoryID, @DocumentWorkflowStepID, @DocumentPublishFrom, @DocumentPublishTo, @DocumentUrlPath, @DocumentCulture, @DocumentNodeID, @DocumentPageTitle, @DocumentPageKeyWords, @DocumentPageDescription, @DocumentShowInSiteMap, @DocumentMenuItemHideInNavigation, @DocumentMenuCaption, @DocumentMenuStyle, @DocumentMenuItemImage, @DocumentMenuItemLeftImage, @DocumentMenuItemRightImage, @DocumentPageTemplateID, @DocumentMenuJavascript, @DocumentMenuRedirectUrl, @DocumentUseNamePathForUrlPath, @DocumentStylesheetID, @DocumentContent, @DocumentMenuClass, @DocumentMenuStyleHighlighted, @DocumentMenuClassHighlighted, @DocumentMenuItemImageHighlighted, @DocumentMenuItemLeftImageHighlighted, @DocumentMenuItemRightImageHighlighted, @DocumentMenuItemInactive, @DocumentCustomData, @DocumentExtensions, @DocumentTags, @DocumentTagGroupID, @DocumentWildcardRule, @DocumentWebParts, @DocumentRatingValue, @DocumentRatings, @DocumentPriority, @DocumentType, @DocumentLastPublished, @DocumentUseCustomExtensions, @DocumentGroupWebParts, @DocumentCheckedOutAutomatically, @DocumentTrackConversionName, @DocumentConversionValue, @DocumentSearchExcluded, @DocumentLastVersionNumber, @DocumentIsArchived, @DocumentHash, @DocumentLogVisitActivity, @DocumentGUID, @DocumentWorkflowCycleGUID, @DocumentSitemapSettings, @DocumentIsWaitingForTranslation, @DocumentSKUName, @DocumentSKUDescription, @DocumentSKUShortDescription, @DocumentWorkflowActionStatus, @DocumentMenuRedirectToFirstChild, @DocumentInheritsStylesheet, @DocumentCanBePublished);

SELECT SCOPE_IDENTITY() AS [ID]

Caused exception: 
Cannot insert the value NULL into column 'DocumentInheritsStylesheet', table 'oacdb.dbo.CMS_Document'; column does not allow nulls. INSERT fails.
The statement has been terminated.


Exception type: System.Exception
Stack trace: 
   at CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, Exception ex)
   at CMS.DataEngine.AbstractDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)
   at CMS.DataEngine.AbstractDataConnection.CMS.DataEngine.IDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)
   at CMS.DataEngine.GeneralConnection.RunQuery(QueryParameters query)
   at CMS.DataEngine.GeneralConnection.RunQueryWithRetry(QueryParameters query, Int32 retryCount)
   at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query)
   at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords)
   at CMS.DataEngine.DataQueryBase`1.GetDataFromDBInternal()
   at CMS.DataEngine.DataQueryBase`1.GetDataFromDB()
   at CMS.DataEngine.DataQueryBase`1.GetData()
   at CMS.DataEngine.SimpleDataClass.Insert(Boolean initId)
   at CMS.DataEngine.AbstractInfoBase`1.InsertDataInternal()
   at CMS.DataEngine.AbstractInfoBase`1.InsertData()
   at CMS.DataEngine.AbstractInfoBase`1.GeneralizedInfoWrapper.InsertData()
   at CMS.DataEngine.AbstractInfoProvider`3.SetInfo(TInfo info)
   at CMS.DocumentEngine.Internal.DocumentCultureDataInfoProvider.SetInfo(DocumentCultureDataInfo info)
   at CMS.DocumentEngine.Internal.DocumentCultureDataInfo.SetObject()
   at CMS.DataEngine.BaseInfo.Insert()
   at CMS.DocumentEngine.TreeNode.InsertCultureData()
   at CMS.DocumentEngine.TreeNode.InsertNode(TreeNode parent)
   at CMS.DocumentEngine.TreeNode.InsertInternal(TreeNode parent)
   at CMS.DocumentEngine.TreeNode.Insert(TreeNode parent, Boolean useDocumentHelper)
   at CMS.DocumentEngine.DocumentHelper.InsertDocument(TreeNode node, TreeNode parentNode, TreeProvider tree, Boolean allowCheckOut)
   at CMS.DocumentEngine.TreeNode.Insert(TreeNode parent, Boolean useDocumentHelper)
   at CMS.DocumentEngine.VersionManager.RestoreDocumentInternal(Int32 versionHistoryId)
   at CMSModules_RecycleBin_Controls_RecycleBin.RestoreDataSet(CurrentUserInfo currentUserInfo, DataSet recycleBin)
   at CMSModules_RecycleBin_Controls_RecycleBin.Restore(Object parameter)

Message: Cannot insert the value NULL into column 'DocumentInheritsStylesheet', table 'oacdb.dbo.CMS_Document'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Correct Answer

Rui Wang answered on November 7, 2018 19:42

If you want to manually fix this issue.

  1. You will need to open your database.
  2. In the CMS_VersionHistory table, locate this page.
  3. Get the NodeXML of that page.
  4. Update the NodeXML to include <DocumentInheritsStylesheet>true</DocumentInheritsStylesheet>
  5. Then you should be able to restore the page.
0 votesVote for this answer Unmark Correct answer

Recent Answers


Rui Wang answered on November 7, 2018 19:35

Is the a site that's upgraded from v8.2 to the latest? DocumentInheritsStylesheet column doesn't exist in v8.2. Was the page delete in v8.2 and now you want to restore it in the newer version?

0 votesVote for this answer Mark as a Correct answer

Gabe R answered on November 7, 2018 19:41

Hi Rui,

Thanks for the reply. The page was created in 8.2, then we upgraded our site to 11, and then the page was deleted. Does this mean I need to add DocumentInheritsStylesheet to the page type?

Thanks again,

G

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on November 7, 2018 19:47 (last edited on November 7, 2018 19:48)

DocumentInheritsStylesheet is part of the default CMS_Document since version 9. You don't need to add the field to any page type.

I'm pretty sure this page was delete before the upgrade, otherwise, it should picked up the field during the upgrade.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.