AEM 6.5 SPA React | Nested Multifield Not working | Community
Skip to main content
Level 5
January 19, 2023
Solved

AEM 6.5 SPA React | Nested Multifield Not working

  • January 19, 2023
  • 2 replies
  • 3870 views

Hi All,

 

I am using nested multifield in AEM6.5 SPA with react. It is not rendering in model json.

Any help is highly appreciated.

 

Thanks,

Pradeep

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Vajrala

Other fields are appearing in model json.


It seems like a particular case; you need to troubleshoot to resolve the issue.

Did you create a separate sling model to read the values of nested multifield from JCR? If yes, I would check whether the sling model has the ComponentExporter adapter and Exporter annotation for exporting the values via the model.json framework.

Lastly, I would start checking for any errors in the logs, and if there are no NPE or other errors, run the AEM in debug mode, add breakpoints in the sling model, and observe the values read from the JCR.

2 replies

Lokesh_Vajrala
Community Advisor
Community Advisor
January 19, 2023

Hi @pradeepdubey82 

 

How are the values persisting for nested multifield in JCR? If you're persisting the property values in node hierarchy (child nodes for nested multifield values), then you've to read them in the Component Sling Model using the Child Resource From Request Injector. 

Level 5
January 19, 2023

Yes values are persisting in jcr also loading in cq dialog. I am using childresource annotation for the element in sling model. 

Still it is not rendering in model json. 

 

Thanks,

Pradeep

Lokesh_Vajrala
Community Advisor
Community Advisor
January 19, 2023

Ok. Question: Other properties of component except the nested multifield are showing up in model.json response? 

Kiran_Vedantam
Community Advisor
Community Advisor
January 19, 2023

Hi @pradeepdubey82 

 

Can you please share the below details to debug further?

  1. Your model code
  2. The JCR node - on how the data is being stored
  3. If there is any error in the log

Mainly the issue happens while injecting, as you have mentioned that you can see the values in the JCR.

 

Thanks,
Kiran Vedantam.

Level 5
January 20, 2023

Hi Kiran,

 

I am sharing below for reference.

JCR structure 

 

 

Sling models

Model json

CQ dialog 

 

 

Leela-Pavan-Kumar
Level 4
January 20, 2023

Hi @pradeepdubey82 ,

 

Try to inject like this 

@Inject @Via("resource") @Named("accordians") private List<Resource> accordians;

 

Try to adapt each resource to AccordionModal

public List<AccordionModal> getAccordionModalList() { List<AccordionModal> AccordionModalList = new ArrayList<>(); if (null != accordions) { accordions.forEach(i -> AccordionModalList.add(i.adaptTo(AccordionModal.class))); } return AccordionModalList; }

 

Do the same thing for AccordionBulletPointModal.