Loading

Error 'Duplicate value found when building unique index' on field set up as ‘Unique’

Дата публикации: May 27, 2026
Описание

When attempting to mark a field as Unique, Salesforce builds an index for that field. If the unique index contains duplicate values (e.g. if there are multiple existing records which have the same value in the field we are trying to make unique), then the operation will fail and the Unique attribute will not be set.

Решение

To successfully mark a field as Unique in Salesforce, all existing records (including those in the Recycle Bin) must have distinct values in that field. If duplicate values exist, Salesforce cannot build the required unique index and will return this error.


## Steps to Resolve

  • Ensure that no two records contain the same value in the field being set as unique.
  • All existing records must have unique values, or no value at all, in the field.  This includes records in the Recycle Bin. Set the Unique attribute once these steps have been confirmed.

Recycle Bin callout: Ensure the Recycle Bin note is explicit: "Important: Records in the Recycle Bin also count toward duplicate checking. Empty the Recycle Bin or ensure those records also have unique values before retrying.




Номер статьи базы знаний

000385434

 
Загрузка
Salesforce Help | Article