1

We are creating pages using core services on Sites 9.5. Once page created, it is not editable further. We can't further add components to the region. The plus green button is visible in CME but click on it doesn't open the dialog box to allow to add components. Apparently we can delete the component. Also we see region properties are not shown in right pane of page design. Code used is as below

#region Create Meal Plan Options Page in 07 Channel Master Meal Plan Structure Group _logger.LogInformation($"START : Creating PageData for tenant {_targetTenantTitle}");

        List<ComponentPresentationData> leftComponentPresentationDatas = new List<ComponentPresentationData>();
        if (bodyCopyMealPlanOptionsComponent != null)
            leftComponentPresentationDatas.Add(new ComponentPresentationData()
            {
                Component = new LinkToComponentData() { IdRef = TCMHelper.Get07IDofComponent(bodyCopyMealPlanOptionsComponent.Id) },
                //Component = new LinkToComponentData() { IdRef = bodyCopyMealPlanOptionsComponent.Id },
                ComponentTemplate = new LinkToComponentTemplateData() { IdRef = TargetConstants.BodyCopyComponentTemplate }
            });

        
        if (bodyCopyMealPlanOptionsAdditionalComponent != null)
            leftComponentPresentationDatas.Add(new ComponentPresentationData()
            {
                Component = new LinkToComponentData() { IdRef = TCMHelper.Get07IDofComponent(bodyCopyMealPlanOptionsAdditionalComponent.Id) },
                //Component = new LinkToComponentData() { IdRef = bodyCopyMealPlanOptionsComponent.Id },
                ComponentTemplate = new LinkToComponentTemplateData() { IdRef = TargetConstants.BodyCopyComponentTemplate }
            });

                if (!String.IsNullOrEmpty(accordianMealPlanOptionsComponent.Id))
                leftComponentPresentationDatas.Add(new ComponentPresentationData()
                {
                    Component = new LinkToComponentData() { IdRef = TCMHelper.Get07IDofComponent(accordianMealPlanOptionsComponent.Id) },
                    //Component = new LinkToComponentData() { IdRef = accordianMealPlanOptionsComponent.Id },
                    ComponentTemplate = new LinkToComponentTemplateData() { IdRef = TargetConstants.AccordionComponentTemplateID },
                });

        PageData _mealPlanOptionsPageData = new PageData()
        {
            Title = TargetConstants.TenantMealPlanOptionsFolderName,
            LocationInfo = new LocationInfo()
            {
                OrganizationalItem = new LinkToOrganizationalItemData() { IdRef = mealPlan07SGData.Id }
            },
            Metadata = TargetConstants.MealPlanOptionsPageMetadata.Replace("INSERT_MealPlanOptions_PAGEINFO_ID", TCMHelper.Get07IDofComponent(pgMealPlanOptionsComponent.Id)),
            
            MetadataSchema = new LinkToSchemaData() { IdRef = TargetConstants.PageMetadataSchemaID },
            FileName = TargetConstants.TenantMealPlanOptionsFileName.ToLower(),
            PageTemplate = new LinkToPageTemplateData() { IdRef = TargetConstants.GenericPageTemplateSchemaID },
            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.GenericRegionSchemaID },
            Regions = new RegionList()
            {
                new EmbeddedRegionData()
                {
                    RegionName = "hero",
                    Metadata = TargetConstants.MealPlanOptionsRegionDataHeroMetadata,
                    RegionSchema = new LinkToSchemaData(){IdRef = TargetConstants.MealPlanOptionsColumnsHeroRegionSchemaID},
                    Regions = new RegionList()
                    {
                        new EmbeddedRegionData()
                        {
                            RegionName = "left",
                            ComponentPresentations = new ComponentPresentationData[]
                            {
                                new ComponentPresentationData()
                                {
                                    Component = new LinkToComponentData() { IdRef = TCMHelper.Get07IDofComponent(linksMealPlanOptionsComponent.Id) },
                                    //Component = new LinkToComponentData() { IdRef = linksMealPlanOptionsComponent.Id },
                                    ComponentTemplate = new LinkToComponentTemplateData(){ IdRef = TargetConstants.JumbotronComponentTemplate}
                                },
                            },
                            Metadata = TargetConstants.RegionDataMetadata,
                            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.RegionHeroInnerLeftSchemaID }
                        },
                        new EmbeddedRegionData()
                        {
                            RegionName = "center",
                            Metadata = TargetConstants.RegionDataMetadata,
                            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.RegionHeroInnerCenterSchemaID }
                        },
                        new EmbeddedRegionData()
                        {
                            RegionName = "right",
                            Metadata = TargetConstants.RegionDataRightMetadata,
                            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.RegionCardsSchemaID },
                            Regions = new RegionList(){
                                new EmbeddedRegionData()
                                {
                                    RegionName = "top",
                                    Metadata = TargetConstants.RegionDataMetadata,
                                    RegionSchema = new LinkToSchemaData(){IdRef = TargetConstants.RegionStandardSectionTitleSchemaID }
                                }
                            }
                        },
                    }
                },
                new EmbeddedRegionData()
                {
                    RegionName = "main",
                    Metadata = TargetConstants.MealPlanOptionsRegionDataMainMetadata,
                    RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.MealPlanOptionsRegionTwoColumnSchemaID },
                    Regions = new RegionList()
                    {
                        new EmbeddedRegionData()
                        {
                            RegionName = "left",
                            ComponentPresentations = leftComponentPresentationDatas.ToArray(),
                            Metadata = TargetConstants.MealPlanOptionsMainLeftRegionMetadata,
                            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.RegionSchemaStandard }
                        },
                        new EmbeddedRegionData()
                        {
                            RegionName = "right",
                            Metadata = TargetConstants.MealPlanOptionsMainLeftRegionMetadata,
                            RegionSchema = new LinkToSchemaData() { IdRef = TargetConstants.RegionSchemaStandard }
                        }
                    }
                }
            }
        };
        _mealPlanOptionsPageData = UpsertPageData(_targetClient, _mealPlanOptionsPageData, _logger);
        _logger.LogInformation($"END : Creating PageData for tenant {_targetTenantTitle} - [{_mealPlanOptionsPageData.Id} , {_mealPlanOptionsPageData.Title}]");
        #endregion Create Meal Plan Options Page in 07 Channel Master Meal Plan Structure Group
2
  • I can't add new components to the page created using core services (code above in main post). Please help. In UI, a dialog box appears when you edit the page design - Update the current set of nested Regions? Can you add the consent through core service of update the set of nested Regions to make it valid against the Page Schema?
    – user2750
    Apr 17 at 6:39
  • I agree with @Rick, the structure probably doesn't match. I know we have Component synchronization methods over the APIs, but I'm not 100% sure for pages. However, you probably don't want to do a synchronization after the fact (what you probably mean by "consent") but rather you want the Page's Component Presentation to already match, if that makes sense. Apr 18 at 17:16

1 Answer 1

2

Based on what you described, it seems that the Page structure doesn't match your Page/Region Schemas. In the provided code I see you do set Region Schemas, but I can't see whether the structure defined in those matches the structure of the Page.

Furthermore, I see that you set Page.RegionSchema directly, but this is a derived property; the Page Schema should be set on the Page Template and by setting Page.PageTemplate, you implicitly set Page.RegionSchema too.

Maybe you did not associate your Page Schema with your Page Template?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.