Expand my Community achievements bar.

SOLVED

Multifield or multfield like structure for Content Fragment Model.

Avatar

Community Advisor

Hi Team,

I was working on to design a data model for content fragment model and got stuck on for a field which needed one multifield like structure as:

Umesh_Thakur_0-1720847132334.png

one multifield with 3 different fields for social links.

I gone thru many articles and blog with custom implementation but somehow it did not worked for me.I did try reference as well but it is again not suitable. 
can anyone suggest any alternative to achieve the same.

Thanks you

Umesh Thakur

1 Accepted Solution

Avatar

Correct answer by
Level 6

There is a long discussion and here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-frag...

Please check this link. And its not possible unless you develop something like it

View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

There is a long discussion and here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-frag...

Please check this link. And its not possible unless you develop something like it

Avatar

Level 7

Hi @Umesh_Thakur 
As @kaikubad Stated , you can have a look at the existing discussion on the blog post.
How we did in our project is that we used the JSON Field Approach.
We used a JSON field to simulate a multifield structure.

  • Add a JSON field to your Content Fragment model.
  • Structure your data as an array of objects within this JSON field.
  • When using the Content Fragment, you'll need to parse and handle this JSON data in your components or services.

Let me know if your use case can be solved by this.

Avatar

Level 2

Make 2 Content Fragment Models.
1st containing all the fields you want to repeat,
2nd containing a content fragment variation path

Now while making the content fragments, author by using the 1st one how many times you want.
Then create a CF with the second one and add all the 1st ones into it.

Now retrieve the data on a single hit, in your code through graphQL API.

Avatar

Level 4

 create two Content Fragment Models: one for the social link and another for the container. The social link model would contain the individual fields for the social link (e.g., link type and URL), and the container model would contain a content fragment variation path that references the social link model.

 

<!-- Social Link Model -->
type SocialLinkModel {
linkType: String
linkUrl: String
}

<!-- Container Model -->
type ContainerModel {
socialLinks: [SocialLinkModel]
}

 

In this example, the ContainerModel contains a field called socialLinks that references an array of SocialLinkModel instances.