1
votes

Had some trouble getting the newly created fields using the "this.cmsservice.getcurrentpage()".

I've tried extending the PageNormalizer, but unsuccessful.

Any idea or workaround.

2
Can you explain where you added custom fields? Was it on the page itself, or on a specific compknent?tobi-or-not-tobi
on the page itself. the payload kinda looks like this.. <label>/testLabel</label> <category>TEST CATEGORY</category> </page> should i just put it in a component level?chilliReaper

2 Answers

1
votes

Resolved this by extending/overriding the 'CMS_PAGE_NORMALIZER'. Added the new field under the properties of the original structure.

See below code:

export class pageNormalizer implements Converter<Occ.CMSPage, CmsStructureModel> {
  convert(source: any, target?: CmsStructureModel): CmsStructureModel {
    target.page.properties = {
      newfield: source.newfield,
    };
    return target;
  }
}
-1
votes

Although I never worked with the spartacus-storefront, you problem seems similar to another one I´ve seen here before.

Try this:

https://pipedrive.readme.io/docs/adding-a-new-custom-field