Hello,
We are in the process of migrating an old Kentico 11 site to Xperience by Kentico. Part of this is migratingĀ is creating Content Types from code and then creating pages for the newly created content types. We are creating a content type with:
dataClassInfo.ClassFormDefinition = form.GetXmlDefinition();
DataClassInfoProvider.SetDataClassInfo(dataClassInfo);
Where the form has a few default fields for pages like ContentItemDataID, ContentItemDataCommonDataID and ContentItemDataGUID.
We are not creating any other fields with PrimaryKey = true. We can see the newly created content type in the UI, but when we try to create a page of this type, we get an Exception on CreateWebPageBase - SubmitFirstStep:
Message: Value cannot be null. (Parameter 'identifier')
Exception type: System.ArgumentNullException````Stack trace:````at Kentico.Xperience.Admin.Base.Forms.FormComponentMapper.MapCore(IEnumerable1 formFields)+MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)````at Kentico.Xperience.Admin.Base.Forms.FormComponentMapper.Map(IEnumerable1 formFields) at Kentico.Xperience.Admin.Base.Forms.FormComponentsFormUtils.GetFormItems(Int32 dataClassId) at Kentico.Xperience.Admin.Websites.UIPages.Internal.CreateWebPageBase2.GetCombinedFormItems(CreateWebPageCreateCommandArguments args, Boolean useExistingValue, CancellationToken cancellationToken)````at Kentico.Xperience.Admin.Websites.UIPages.Internal.CreateWebPageBase2.SubmitSecondStep(CreateWebPageCreateCommandArguments args, CancellationToken cancellationToken) at Kentico.Xperience.Admin.Websites.UIPages.CreateWebPage.SubmitSecondStep(CreateWebPageCreateCommandArguments args, CancellationToken cancellationToken) at Kentico.Xperience.Admin.Websites.UIPages.Internal.CreateWebPageBase2.SubmitFirstStep(FormSubmissionCommandArguments args, CancellationToken cancellationToken)
Are we missing something in the creation of the content type? Is there another way to set the fields of the content type? How can we fix the problem?
Thank you in advance.
Environment
- Xperience by Kentico version: [30.9.2]
- .NET version: [8]
- Execution environment: [OnPremise]
- Link to relevant Xperience by Kentico documentation