Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Nested multifield within multifield - Content fragment Model

Avatar

Level 2

I have a use-case where we are using custom datatypes ,  multifield within another multifield in a Content fragment model.

 

Following link was helpful and js works as expected but when there is another multifield within a multifield the values are not saved for the second multifield - 

https://jimfrenette.com/aem/content-fragments/composite-multifield/#google_vignette

 

java.lang.IllegalArgumentException: Value for key products can't be put into node: [Ljava.lang.Object;@5fde8369
at org.apache.sling.jcr.resource.internal.JcrModifiableValueMap.put(JcrModifiableValueMap.java:458) [org.apache.sling.jcr.resource:3.0.18]

Caused by: javax.jcr.nodetype.ConstraintViolationException: No matching property definition: products = [testing12345, name2updated, name3updated]

 

Is there a way to achieve this on AEM 6.5, SP 17. Is there a good documentation with Adobe for this usecase?

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sonaliku Yes the graphQL query result provides the result in the json format.

In the screenshot attached I am having the college as my main CF and student as the reference CF added as the multifield in the college CF. 
While writing the query you can specify the json format with the respective fields you wish to have in your json.

Shailesh_Bassi__0-1693244286282.png

Shailesh_Bassi__1-1693244403448.png

 

Hope this helps!

Thanks

View solution in original post

8 Replies

Avatar

Community Advisor

@sonaliku , you might be trying to set this property product on a different node, possibly the jcr:content node.

Check what is the node name where you trying to add this property.

Avatar

Community Advisor

Unfortunately, these are custom implementations, so there is no official support for these use cases. Nevertheless, the issue suggests that the value or type of value being stored in the node is not accepted. Either the type of node or the value is causing the issue. Therefore, the best approach to fixing this would be to debug and understand which values are being stored in which nodes.

 

Hope this helps.



Esteban Bustamante

Avatar

Community Advisor

Hi @sonaliku There is no OOTB way to create the multifield. Instead you can try the reference to another content fragment within the main content fragment.

 

cfm.png

 

 

Reference Document - https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/journeys/a...

 

Hope this helps!

Thanks

Avatar

Level 2

@ShaileshBassi The use case is for CAAS to load the json structure. If we are using fragment reference , we would want to load the entire json content of the nested fragment into the current content fragment and not just the path. Do we have an example of this?

Avatar

Correct answer by
Community Advisor

Hi @sonaliku Yes the graphQL query result provides the result in the json format.

In the screenshot attached I am having the college as my main CF and student as the reference CF added as the multifield in the college CF. 
While writing the query you can specify the json format with the respective fields you wish to have in your json.

Shailesh_Bassi__0-1693244286282.png

Shailesh_Bassi__1-1693244403448.png

 

Hope this helps!

Thanks

Avatar

Employee

Its better to use fragment reference. Custom multifields might create an issue as the number of fields to be authored increases in requirement.

Avatar

Level 2

@varun249715 Fragment reference is providing the path of the fragment based on the model selected. If this approach is used , we would want the entire json to be loaded. Any examples on that approach for CAAS?