Print this page

Error when setting the Unique attribute on a field: 'Duplicate value(s) found when building unique index'

Knowledge Article Number 000004532
Description

When I attempt to set a custom field as Unique, an error is received: "Duplicate value(s) found when building unique index".

Resolution

When you attempt 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 address this, ensure that no 2 records contain the same value in the field you are trying to set as unique. All existing records must have unique values, or no value at all, in the field. You can then set the Unique attribute.





promote demote