Create document with long name

Tomasz Czado asked on November 9, 2015 17:34

Hi, today I've made some changes in Kentico's database structure:

  • added CMSMaxNodeNameLength to web.config and set to 200
  • updated NodeName (CMS_Tree table), DocumentName (CMS_Document table), DocumentName (CMS_EventLog table), PageTemplateDisplayName (CMS_PageTemplate table), VersionDocumentName (CMS_VersionHistory table)

Also, I had defined OnAfterInsertDocument event, where I used DocumentHelper.UpdateDocument. In this place after inserting document, exception occurs. Please see stack. I know, that column is truncated but I don't know which and why. Maybe it is because I didn't change CMSMaxNodeAliasLength?

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.GeneralConnection.RunQuery(QueryParameters query)
at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query)
at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords)
at CMS.DataEngine.DataQueryBase`1.GetDataFromDB()
at CMS.DataEngine.DataQueryBase`1.GetData()
at CMS.DataEngine.DataQueryBase`1.Execute()
at CMS.DataEngine.AbstractInfo`1.UpdateData()
at CMS.DataEngine.AbstractInfoProvider`2.SetInfo(TInfo info)
at CMS.DocumentEngine.TreeNode.UpdateCultureData()
at CMS.DocumentEngine.TreeNode.UpdateInternal()
at CMS.DocumentEngine.TreeNode.Update(Boolean useDocumentHelper)
at CMS.DocumentEngine.VersionManager.SaveVersionInternal(TreeNode node, String versionNumber, String versionComment, String updateColumns, WorkflowInfo forceWorkflow)
at CMS.DocumentEngine.DocumentHelper.UpdateDocument(TreeNode node, TreeProvider tree, String updateColumns)
at CMS.DocumentEngine.TreeNode.Update(Boolean useDocumentHelper)
at CMS.FormControls.CMSDocumentManager.UpdateDocumentInternal(Boolean useDocumentHelper)
at CMS.FormControls.CMSDocumentManager.UpdateDocument(Boolean useDocumentHelper)
at CMS.FormControls.CMSForm.SaveDataInternal()
at CMS.FormControls.BasicForm.SaveData(String redirectUrlAfterSave, Boolean showChangesSaved)
at CMS.FormControls.CMSForm.DocumentManager_OnSaveData(Object sender, DocumentManagerEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at CMS.FormControls.CMSAbstractManager`2.RaiseSaveData(EventArgsType args)
at CMS.FormControls.CMSDocumentManager.SaveDocumentInternal(String actionContext)

Message: String or binary data would be truncated.
The statement has been terminated.

Thank you for any help.

Recent Answers

Brenden Kehren answered on November 9, 2015 20:29

Where did you make the modifications, directly in the database? If so, there is most likely a conflict with the actual database schema and the schema which is stored within the cms_class table.

0 votesVote for this answer Mark as a Correct answer

Tomasz Czado answered on November 9, 2015 20:42 (last edited on November 9, 2015 20:51)

Hi, Yes, I updated database directly. So where should I also do it?

I see that for example cms.document in cms_class table has wrong DocumentName column size - that needs to be updates too. Is there any UI in Kentico helps to update this xml?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 9, 2015 21:01

If you're using v8, you can make changes within the Modules>module name>Classes. The Classes are where your database schema are defined and updated.

0 votesVote for this answer Mark as a Correct answer

Tomasz Czado answered on November 9, 2015 21:14 (last edited on November 9, 2015 21:15)

I checked: Modules > Pages > Page (Class), then I tried to update Document name, but this field is locked to edit and whole this table "Is customizable" has set to false.

I'm using Kentico v8

0 votesVote for this answer Mark as a Correct answer

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