6

We have a Page with Component A (a container Component) associated with a static template which has another Component B as a Linked Component field. In the associated model for B, I have created a field to serve URL like:

@SemanticProperty("_self")
private String url; 

URL field is always empty, even if the Page containing parent Component A is published. There is a dynamic Component Template present for the Component B. Here is the diagram of page AB where B is present as a linked component:

enter image description here

I am mapping model for page CD where B is also present which has the url field with empty value:

enter image description here

Can anyone suggest if I am missing anything?

5
  • is B also attached to some page?
    – Raj Kumar
    Commented Apr 19, 2017 at 10:51
  • @Raj, I have updated my question with information. Commented Apr 19, 2017 at 11:01
  • Can you edit your question and explain some more detail about the actual Schemad and models for the Components C, D and B? Commented Apr 19, 2017 at 12:05
  • Mukesh, your link property is set to _self. This means that this link will be resolved as a link of the component itself (not as a link to the component you are linking to). What happens if you change "_self" to the actual schema field name of the componentlink field ? Commented Apr 19, 2017 at 12:22
  • Harald, in main model A it is added as actual schema field name as a type of view model of B and in view model url is defind with "_self" semantic property. Commented Apr 19, 2017 at 13:14

1 Answer 1

3

Despite your pictures, the structure of your View Models (and how they map to Components in CM) is not quite clear to me. For example: what does "Component as embedded field" mean? Do you mean you have an embedded View Model mapped to an embedded field?

Regardless, it seems to me you want to get a link to Component B resolved. DXA link resolving will resolve a Component link to a URL of a published Page which contains a Component Presentation for the linked Component.

In your description, I don't see that you have such a Page, which could explain why the link does not resolve.

In case Component B is a Multimedia Component, you may want to resolve a link to its published Binary content instead. In that case, you should make the property of type MediaItem (or a subclass).

1
  • Hi Rick, this sounds a answer for my question. I was also suspecting that without a direct component presentation with the component it can't be resolved. Commented Apr 20, 2017 at 6:50

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.