form validation for unique fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • jamie
    commented on 's reply
    But no plans for the future? I'd hate to implement something that will be included in the near future

    Anywhere I can look for examples on how to implement?

  • yuri
    replied
    It was considered before.

    For now, I suggest to add to call an additional check in before create/save record hook and throw a Conflict exception with a message body. We've done it multiple time.

    Leave a comment:


  • jamie
    replied
    Originally posted by yuri
    It's not a bug. We don't have such a feature currently. It needs to be handled manually (in a hook or a wrapper).
    might this be something you'll be adding in the future?

    Leave a comment:


  • yuri
    replied
    It's not a bug. We don't have such a feature currently. It needs to be handled manaully (in a hook or a wrapper).

    Leave a comment:


  • jamie
    started a topic form validation for unique fields

    form validation for unique fields

    Steps to Reproduce:
    1. Attempt to create or update any record in EspoCRM with a value that violates a unique constraint (e.g., duplicate number, email, or other unique field).
    2. Submit the form.

    Expected Behavior:
    • The form should display a validation error indicating which field violates the uniqueness constraint.

    Actual Behavior:
    • Submission fails with a 500 error instead of a user-friendly validation message.
    • Example error in log:
    [2025-10-01 13:47:39] CRITICAL: (23000) SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Q-02904-Ad' for key 'UNIQ_C_SALES_QUOTE_NUMBER' :: POST /Quote :: /var/www/html/application/Espo/ORM/Executor/DefaultSqlExecutor.php(77)
    Environment:
    • EspoCRM version: 9.1.8
    • PHP version: 8.3
    • Database: maria db
Working...