Skip to content

Import - add duplicate check on import #12810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 24, 2025

Conversation

etiennejouan
Copy link
Contributor

@etiennejouan etiennejouan commented Jun 24, 2025

Screenshot 2025-06-24 at 11 43 03

Test :

  • Add duplicate on id or on primaryEmail for people or primaryUrlLink on companies

closes twentyhq/core-team-issues#909

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added uniqueness constraint validation during spreadsheet imports to prevent duplicate entries across both simple and composite fields.

  • Implemented spreadsheetImportComputeUnicityRowHook in spreadsheet-import/utils/spreadsheetImportGetUnicityRowHook.ts to validate unique constraints during import
  • Added isIncludedInUniqueConstraint field to composite field configurations in settings/data-model/constants/SettingsCompositeFieldTypeConfigs.ts for primary identifiers
  • Enhanced useOpenObjectRecordsSpreadsheetImportDialog to integrate uniqueness checks through rowHook in import dialog options

3 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Jun 24, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:5010

This environment will automatically shut down when the PR is closed or after 5 hours.

@prastoin prastoin self-requested a review June 24, 2025 12:01

uniqueConstraintFields.forEach((uniqueConstraint) => {
const uniqueConstraintRow = uniqueConstraint
.map((field) => row?.[field] || '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: Unless I'm mistaken we should not be case sensitive here and try to trim most of the fields ?

});
}
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: we might wanna display the failing value along the failing field ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmmh 🤔 not sure it is useful as error message is display when at hover on value

@charlesBochet charlesBochet merged commit 08f8302 into main Jun 24, 2025
54 checks passed
@charlesBochet charlesBochet deleted the ej/909-uniqueness-check-import branch June 24, 2025 14:12
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
<img width="1217" alt="Screenshot 2025-06-24 at 11 43 03"
src="https://github.com/user-attachments/assets/de2bc12e-5e25-484f-a034-f52b0f237a3e"
/>

Test : 
- Add duplicate on id or on primaryEmail for people or primaryUrlLink on
companies

closes twentyhq/core-team-issues#909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend validations
3 participants