twenty
twenty copied to clipboard
Importing relationships via CSV
The biggest limitation of our CSV feature today is that it's not possible to use it to create relationships. So for example if you import a list of people, it can't automatically create/link companies attached to it.
There are different ways to approach this problem. I think the best way for now would be to allow people to include unique identifiers that would automatically be surfaced. A unique identified can be: the id, and external if (e.g. SalesforceId), but also sometimes a business key (email for persons or domain for company).
Unfortunately we don't really have a good way to add unicity constraint to a field, and therefore fetch fields that could be good candidates in a good way. So for v1 I suggest we retried id, externalId only for all objects. And hardcode domain/email for company/people.
So on the frontend, for a given object, we need to add to the list of matchable fields all the fields the one that are coming from relations ([id, externalId] in most cases, and that +domain/email for company/person). And on the backend side, we need to adapt our resolvers to also be able to match through this (company.domain, siblingObject.externalId, etc.)