Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Content Fragment Model - Key & Value Pair

Avatar

Level 2

Hello community,

 

I am trying to implement a key-value pair field to content fragment model. 

For example, as shown in the screenshot below, users should be able to add as many key-value pairs as they want, but instead of being one field below Fragment Reference section, there should be two fields: one for Key and another for Value. I didn't see anything like such in the already available options. Could you help me with a way to implement this or point me to existing way to add this?

 

Screenshot 2024-07-31 at 3.52.50 PM.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 4

You can follow this blog - https://jimfrenette.com/aem/content-fragments/composite-multifield/- to create a composite multifield like an AEM dialog multifield and add it directly inside the content fragment model via CRX. 

View solution in original post

5 Replies

Avatar

Community Advisor

Hi @keno6396 
A similar discussion is on this as well
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-or-multfield-li...
You can checkout my comment on above post.
As well as the accepted solution if that helps.

Avatar

Correct answer by
Level 4

You can follow this blog - https://jimfrenette.com/aem/content-fragments/composite-multifield/- to create a composite multifield like an AEM dialog multifield and add it directly inside the content fragment model via CRX. 

Avatar

Level 2

Thank you. I followed the instructions on that link to achieve what I wanted: composite multifield. Is there way to make that as data type in CFM instead of customizing existing model?

Avatar

Level 4

I have created a separate cfm to have these key value pairs as data types and use that as a multivalued fragment reference in the main model. Basically you will have a seperate model for key value pairs and refer that in main cfm via fragment reference. In this way you will have a proper schema incase you are exposing this via GraphQL

Avatar

Administrator

@keno6396 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni