Import and CollectionLink

Hi,

I’m importing entries from a CSV to a collection A which have CollectionLinks to B, but the A entries fields are not linked to existing B entries, and no additional entries are created in B.

Note that /entries/A view shows the text value imported from the csv, but /entries/A/xxx is showing bugged fields (one is multiple in the image below, the other is not).

So, what would be the correct way to import (or post-process imported entries), in order to have functional links to (existing / not existing) entries in the target collection ?

I may be wrong… (@artur kindly confirm ) but afraid that the import will not work for linked collections, since a new id is created during the import! You may need to build your own import script to do that.
It would be good if we could have a uuid field on the collections and use that for linking, so it will be immune to those situations.

1 Like

I see, thanks. I’m not sure that I would be able to develop a custom import for now, so I’m a bit stuck.

Would you see a devious way ? Maybe changing the input file, maybe from json ?

As the field is populated with a raw text value which is visible in the entries list table, it would be pretty easy to batch correct them from the UI if those fields could be filtered with a text query. It would take only a few operations from the admin.

Ie. API return :

{
  "mycollectionlink" : "My text value"
}

Instead of :

{
  "mycollectionlink": {
    "_id": "876jkhfg7685",
    "link": "othercollection",
    "display": "My text value"
  }
}

But nothing is returned by searching “My text”.