Uniqueness & Duplicate Detection
Prevent duplicate records with uniqueness constraints
Uniqueness & Duplicate Detection
The Uniqueness tab helps you prevent duplicate records by defining constraints that check for matching values before records are saved.
What are Uniqueness Constraints?
Uniqueness constraints are rules that check whether a new or updated record would create a duplicate. They can:
- Block saves when duplicates are detected
- Warn users about potential duplicates while still allowing saves
This prevents data quality issues like duplicate contacts, duplicate invoices, or duplicate entries that can cause confusion and errors.
Accessing the Uniqueness Tab
- Go to Settings > Modules
- Select your module
- Click the Uniqueness tab
Constraint Types
Coherence supports three types of uniqueness constraints:
Simple Unique
A single field must have unique values across all records.
Use cases:
- Email address (each contact has a unique email)
- Invoice number (no two invoices share a number)
- SKU (product identifiers must be unique)
- External ID (integration identifiers)
Composite Unique
A combination of fields must be unique together. Individual field values can repeat, but the combination cannot.
Use cases:
- First Name + Last Name + Company (same name at different companies is OK)
- Product + Variant + Size (unique SKU combinations)
- Year + Month + Sequence (date-based numbering)
Duplicate Detection Rule
Flexible OR-based rules for detecting potential duplicates. Unlike simple uniqueness, these rules support multiple matching conditions and different match types.
Use cases:
- Email matches exactly OR (First Name + Last Name + Phone) matches
- Complex duplicate detection for merging workflows
- Fuzzy matching with normalized values
Creating a Constraint
- Click Add Constraint in the Uniqueness tab
- Fill in the constraint settings:
Basic Settings
| Setting | Description |
|---|---|
| Name | Descriptive name (e.g., "Unique Email") |
| Description | Optional explanation of the constraint |
| Constraint Type | Simple Unique, Composite Unique, or Duplicate Rule |
Field Selection
For Simple Unique: Select one field that must have unique values.
For Composite Unique: Select two or more fields. Check each field to include it. The combination of selected fields must be unique.
For Duplicate Detection Rules: Build rules with AND/OR logic:
- Each rule is a set of field conditions
- Multiple rules are combined with OR (match if ANY rule matches)
- Within a rule, multiple fields are combined with AND (all must match)
Match Types (Duplicate Rules Only)
| Type | Behavior |
|---|---|
| Exact Match | Values must be identical |
| Case Insensitive | Ignores uppercase/lowercase ("John" = "john") |
| Normalized | Ignores spaces, special characters, and case |
Enforcement Mode
| Mode | Behavior |
|---|---|
| Block | Prevents saving if a duplicate is detected |
| Warn | Shows a warning but allows the save |
Choose Block for strict data integrity (like invoice numbers). Choose Warn for soft matching where duplicates are possible but discouraged.
Active Toggle
Enable or disable the constraint without deleting it.
- Click Create to save the constraint
Managing Constraints
Editing Constraints
- Find the constraint in the list
- Click the pencil icon
- Update settings
- Click Save Changes
Deleting Constraints
- Find the constraint to remove
- Click the trash icon
- Confirm deletion
Disabling Constraints
Toggle the Active switch off to disable a constraint without deleting it.
Constraint Display
Each constraint shows:
| Element | Description |
|---|---|
| Icon | Key (simple), Layers (composite), or Search (rule) |
| Name | Constraint identifier |
| Type | The constraint type |
| Enforcement | "Blocks Save" or "Warns Only" |
| Fields | Which fields are checked |
| Status | Active or Disabled badge |
Example Configurations
Unique Email Address
| Setting | Value |
|---|---|
| Name | Unique Email |
| Type | Simple Unique |
| Field | |
| Enforcement | Block |
Unique Name per Company
| Setting | Value |
|---|---|
| Name | Unique Contact per Company |
| Type | Composite Unique |
| Fields | First Name, Last Name, Company |
| Enforcement | Warn |
Flexible Duplicate Detection
| Setting | Value |
|---|---|
| Name | Potential Duplicate Contact |
| Type | Duplicate Detection Rule |
| Rule 1 | Email (exact match) |
| Rule 2 | First Name (case insensitive) AND Last Name (case insensitive) AND Phone (normalized) |
| Enforcement | Warn |
This example warns about duplicates if:
- Email matches exactly, OR
- First name AND last name AND phone all match (with fuzzy matching)
How Constraints Work
During Record Creation
- User fills in the create form
- Before saving, Coherence checks all active constraints
- If a constraint matches:
- Block: Error message, save prevented
- Warn: Warning message, user can choose to save anyway
During Record Editing
Same behavior as creation - constraints are checked against all other records (excluding the current one).
What Gets Checked
- Only active constraints are evaluated
- Empty/null fields are typically skipped in matching
- Matching is done according to the specified match type
Best Practices
Start with Essential Uniqueness
Begin with the most important unique identifiers:
- Email addresses
- Invoice/order numbers
- External system IDs
- Product SKUs
Use Appropriate Enforcement
- Block for true business keys (invoice numbers, IDs)
- Warn for user-friendly duplicate detection (contacts, leads)
Consider User Experience
Too many blocking constraints can frustrate users. Use warnings for "likely duplicates" and only block for "definitely duplicates."
Name Constraints Clearly
Good names help users understand constraint errors:
- ✅ "Unique Email Address"
- ✅ "One Contact per Company"
- ❌ "Constraint 1"
Test with Real Data
Create test records to verify constraints work as expected before publishing the module.
Related: Configuring Fields | Module Builder Guide