DUPLICATE_VALUE: meaning and how to fix it
Quick answer
DUPLICATE_VALUE: A field marked unique (or an external ID with unique values) already holds the value you are saving on another record. Start with: Use the record ID in the message to open the existing record.
Typical message: DUPLICATE_VALUE, duplicate value found: External_Id__c duplicates value on record with id: 001...
Cause
A field marked unique (or an external ID with unique values) already holds the value you are saving on another record.
How to fix DUPLICATE_VALUE
- Use the record ID in the message to open the existing record.
- Update that record instead of inserting a new one, or change the value.
- In Apex or a data load, use upsert on the external ID field to update-or-insert.
Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.
Frequently asked questions
What does DUPLICATE_VALUE mean in Salesforce?
A field marked unique (or an external ID with unique values) already holds the value you are saving on another record.
How do I fix DUPLICATE_VALUE?
1. Use the record ID in the message to open the existing record. 2. Update that record instead of inserting a new one, or change the value. 3. In Apex or a data load, use upsert on the external ID field to update-or-insert.
More Data and DML errors
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.