Skip to content
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

[Unique Field] : Validating Content Type with two Unique Fields is not being handled #30894

Closed
Tracked by #29459
jcastro-dotcms opened this issue Dec 9, 2024 · 3 comments · Fixed by #31108
Closed
Tracked by #29459

Comments

@jcastro-dotcms
Copy link
Contributor

Parent Issue

Problem Statement

Content Types can have more than one Unique Field in their definition. When you have a Contentlet with different unique values, and create another Contentlet that uses one of the value from the other Contentlet, a raw SQL error ie being displayed to the user.

Steps to Reproduce

  • In your docker-sompose.yml file, enable the feature flag:
DOT_FEATURE_FLAG_DB_UNIQUE_FIELD_VALIDATION: true
  • Start dotCMS with the Full Starter.
  • Create a Content Type with two unique Text fields:
    • Title
    • Number
  • Create a Contentlet with the following data:
    • Title = 111
    • Number = 222
  • Now, try to create another Contentlet with the following data:
    • Title = 111
    • Number = 555
  • The following error shows up in the UI:

screenshot_2024-12-09_at_10 31 05___am_720

Acceptance Criteria

dotCMS must be able to validate as many Unique Fields as available.

dotCMS Version

Latest main.

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@jcastro-dotcms jcastro-dotcms moved this from New to Next 1-3 Sprints in dotCMS - Product Planning Dec 9, 2024
@freddyDOTCMS freddyDOTCMS moved this from Next 1-3 Sprints to Current Sprint Backlog in dotCMS - Product Planning Jan 8, 2025
@freddyDOTCMS freddyDOTCMS moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Jan 8, 2025
@freddyDOTCMS freddyDOTCMS self-assigned this Jan 8, 2025
@freddyDOTCMS freddyDOTCMS added the on hold In Progress, but paused to work on higher priority card label Jan 8, 2025
@jcastro-dotcms
Copy link
Contributor Author

INTERNAL QA: PASSED ✅

  • Docker image: trunk_249c34d

When checking the uniqueness of fields flagged as unique, we're now returning an error as soon as the first unique field is duplicated. This makes the error easier to report and handle. Additionally, we're no longer getting the SQL stack trace in the error message in the UI.

@dsilvam dsilvam added Sprint: Planned and removed on hold In Progress, but paused to work on higher priority card labels Jan 21, 2025
@dsilvam dsilvam closed this as completed Jan 22, 2025
@jcastro-dotcms
Copy link
Contributor Author

This code fix was tested in the Authoring server, and it worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment