TransWikia.com

Feed Me with Related Entries Fields - One to Many Relationship

Craft CMS Asked on June 2, 2021

I’m using Feed Me to populate content for a "Meetings" section in my site. One of the fields in this section is "Meeting Attendees", which is an entries field relating to a Contacts Section.

I have a JSON file that contains a unique Meeting ID, and this Meeting ID could map to several Contacts. In a simplified form, my JSON file format is essentially this:

[
    {
        "Meeting Title" : "Project Kickoff"
        "Meeting Attendee" : "John Doe"
    },
    {
        "Meeting Title" : "Project Kickoff"
        "Meeting Attendee" : "Jane Smith"
    },
    {
        "Meeting Title" : "Project Kickoff"
        "Meeting Attendee" : "Jim Brown"
    }
]

You’ll see in this simplified example that three Contacts need to be related to the "Project Kickoff" Meeting entry. I have my "Meeting Attendees" entries field configured with no limit on number of selectable entries, and can add multiple entries without issue when entering data manually.

However when I run Feed Me on a data set like the one above, Feed Me seemingly overwrites/replaces the entries rather than adding each as a separate relation. e.g. When Feed Me has completed processing the above dataset, my "Project Kickoff" entry will only have one attendee related ("Jim Brown" in this case – or whatever the last value in the dataset happens to be). For the example data above, I would expect to see all three "Meeting Attendees" names related to the "Project Kickoff" meeting entry.

Is there a way to configure either Feed Me or my JSON data to produce the intended result?

One Answer

Why not define the attendees as an array in your JSON? This should allow multiples to be added to your field.

[
    {
        "Meeting Title" : "Project Kickoff"
        "Meeting Attendees" : ["John Doe", "Jane Smith", "Jim Brown"]
    }
]

Correct answer by Andy on June 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP