Import - Upsert on composite fields (#12615)

To test : 
- Import a record with Id column (for upsert-ing) + some subfields in
each composite fields. Check that only matched subfields are updated
(Main issue)
- Import a record with a multi-select field - Check it works + Match
multi-select field on a non multi-select column, check it does not work.
(Specific bug fixed in second commit is : undefined value in multi
select column (corresponding to no item selected) caused error in
multi-select parsing).

closes https://github.com/twentyhq/core-team-issues/issues/990
This commit is contained in:
Etienne
2025-06-17 11:07:51 +02:00
committed by GitHub
parent 093073d5e2
commit 713d3defef
5 changed files with 144 additions and 217 deletions

View File

@ -5,6 +5,7 @@ import { SpreadsheetColumn } from '@/spreadsheet-import/types/SpreadsheetColumn'
import { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType';
import { SpreadsheetMatchedOptions } from '@/spreadsheet-import/types/SpreadsheetMatchedOptions';
import { t } from '@lingui/core/macro';
import { isDefined } from 'twenty-shared/utils';
import { z } from 'zod';
import { uniqueEntries } from './uniqueEntries';
@ -53,6 +54,7 @@ export const setColumn = <T extends string>(
data
?.flatMap((row) => {
const value = row[oldColumn.index];
if (!isDefined(value)) return [];
const options = JSON.parse(z.string().parse(value));
return z.array(z.string()).parse(options);
})