Create document with BrManageContentEditor

Hello. I’m creating this post in order to get help with some thing I’m struggling right now.

I’m working on a Bloomreach headless project using the Bloomreach SDK and I’m trying to configure the new content button for the Channel Experience.

I’ve managed to create it and show it on the component we just added, but for some reason, I’m not able to link to it (the document) once it’s created, it prompts an error. Doesn’t matter if I save it as draft o click on create. The document is saved correctly with the filled info and its status is unpublished. I need, after that, the document published and linked automatically to the component (which I think it’s the normal flow of this feature)

The fields there are a normal string and a hippo:mirror, so they should be supported by the Experience Manager.

I’m doing it with the documentation from here, and followed this example (adjusting to the things I need)


As you can see, I’m not passing content={document} because I don’t have any document in that moment (check line 10), because it’s just the empty container of the component. This is the code I have right now
image

I also tried adding other stuff, like the relative parameter, the parameter=“document”, and so on, but I always get the same error.

I guess I must be doing something wrong, but I don’t kwow where (or maybe I need something extra)

Thanks for your time.

EDIT: I just found this https://issues.onehippo.com/browse/CMS-14433

Seems it was a known issue, but it’s not explained in the SPA documentation. Checking the comments, says there was a missing parameter, but it doesn’t specify which one. I see you commented there, so maybe you can help me @jasper.floor

The parameter is called “parameter”

``parameter Name of the component parameter in which the document path is stored.

Hi @jasper.floor

I’m not really sure about the answer and if it can be done for our case (maybe we need to change the components)
Let me explain. (I’m following the explanation of component parameter based on this page, that was linked from here, in one of the comments)

We are using dynamicComponents. The component added in the catalog, the primary is hst:componentdefinition.

I saw with the hst:containeritemcomponent, the hst:parameternames and hst:parametervalues appear, but not for the first case.

This is the console configuration I have for the dynamic component I’m trying to have it working.

And this is what I added in the FE.
image

Am I on the right track? I’ve made these changes but it’s still not working, prompting the same error.

Thanks for your help.

Check to see if the document you are trying to create hasn’t actaully already been created. There may be some data inconsistency.

Hello @Mario_Lopez, will advisorParameter hold the location of the document you want to create? I believe the type needs to be hst:jcrpath for this to work. See the example here Dynamic Components - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS under Example: A Dynamic Banner Component

Sorry for the late response, I was on holidays.

@jasper.floor The document wasn’t created before, so it’s not a duplicate or something like that.

@david.bailey Regarding the advisorParameter value, if I put there the route of the document, it’s gonna be the same as the root parameter, isn’t it?

Is there any Bloomreach headless demo which covers this by any chance?

The advisorParameter value would not be the same as root, it would be the path to the actual document. And it needs to be a hst:jcrpath type. Maybe post the config of your dynamic component?

I think the reference SPA is a good starting point, it’s meant for the SaaS version of the CMS so doesn’t work out of the box against your project, but the code would be very similar as the Delivery API is the same. GitHub - bloomreach/bloomreach-reference-spa: brX SaaS + React = ♥️

I’ve checked the project you shared.
A few components in the SPA project just have a parameter=“document1”, which I have no idea what that “document1” is.
image

We have checked other projects we have, but none of them have the content button feature implemented, but what we found, the “Failed to retrieve sitemap …” error is a generic one for the Experience Pages. In a different project, that error prompted when creating a Experience Page, because it wasn’t configured in the sitemap, which makes me wonder, that maybe the problem wasn’t related to the parameter parameter.

Regarding the configuration of the dynamic component, as I showed in the previous image in this thread, this is what we have. I have no idea what to fill in in the parametervalue. I dont know how to fill there the route to the document you just said using the hst:jcrpath

I’ was planning to download the Bloomreach GoGreen React to check if that project has the content button thing, but I can’t find the project.

Hello @Mario_Lopez I investigated this further and found that the issue was a missing sitemapitem to map the location of the created “advisor” documents, which the CMS needs to create links. This seems to have fixed the issue. Also the React code was not setting the “paramater” parameter correctly, which should be set to the name of the parameter in the dynamic component that contains the link to document.

I will add some screenshots to this ticket @Mario_Lopez to explain the implemented solution of @david.bailey, that solved the problem.

The parameter property of the BrManageContentButton component refers in this case to the childnode Advisor, that needs to be a hst:jcrpath type

image

So by adding two nodes to the sitemap in the console, the error is gone and you are redirected to the Publish-tab.

image

/components:
  jcr:primaryType: hst:sitemapitem
  hst:hiddeninchannelmanager: true
  hst:relativecontentpath: components
  /_any_:
    jcr:primaryType: hst:sitemapitem
    hst:relativecontentpath: ${parent}/${1}

I hope this clarifies it even more.