Multifield or multfield like structure for Content Fragment Model. | Community
Skip to main content
Umesh_Thakur
Community Advisor
Community Advisor
July 13, 2024
Solved

Multifield or multfield like structure for Content Fragment Model.

  • July 13, 2024
  • 4 replies
  • 1469 views

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:

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

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 kaikubad

There is a long discussion and here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-fragment-model/td-p/246514 

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

4 replies

kaikubad
Community Advisor
kaikubadCommunity AdvisorAccepted solution
Community Advisor
July 14, 2024

There is a long discussion and here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-fragment-model/td-p/246514 

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

pulkitvashisth
Community Advisor
Community Advisor
July 14, 2024

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.

arko_martech
Adobe Champion
Adobe Champion
July 14, 2024

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.

PGURUKRISHNA
July 15, 2024

 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.