DUPLICATES_DETECTED

A duplicate rule with the Block action stopped the save. This is different from DUPLICATE_VALUE, which is a field-level constraint.

Common causes

  • A matching rule found a similar Lead, Contact or Account, often by fuzzy name and email matching.
  • An integration user is subject to a rule designed for manual data entry.
  • The matching rule is too broad and flags records that are not true duplicates.

How to fix

  • Review the rule in Setup → Duplicate Rules and the matching rule it uses.
  • Change the action from Block to Allow with an alert if a warning is enough.
  • Add a rule condition to exclude the integration user’s profile.
  • In Apex, allow the save explicitly:
Database.DMLOptions opts = new Database.DMLOptions();
opts.DuplicateRuleHeader.allowSave = true;
Database.insert(newContact, opts);

You may also like...