Unable to Undelete records in the Recycle Bin
|Knowledge Article Number||000175894|
|Description||When attempting to un-delete records which we see in the Recycle Bin, we receive an error stating:
Unable to undelete 1 of the record(s) because:
|Resolution||A common cause of this error is that there is a Unique field on the Object being undeleted, or on one of its related child objects, and the deleted record has a value in the Unique field that duplicates the value on an existing record. Thus, undeleting the record in the recycle bin would result in more than 1 record with the same value in the Unique field. This is prohibited by the Unique attribute, and so the undelete fails.
* Remove the Unique flag from the custom field(s) which are causing the error, then undelete the desired records.
* Identify the existing records which have the same value in the Unique field as the deleted records (this can be done by using Data Loader to extract the deleted records, and comparing the values in the unique field against the values on existing records), then clear the value from the Unique field on the existing records so the deleted records may be restored without hitting a data uniqueness error.
This error can also occur when attempting to undelete a previously converted Lead record, if there is an 'after undelete' apex trigger on Leads. The Trigger will attempt to load the Lead, but can not do so on a converted Lead, which causes an Apex exception that causes the undelete to fail. The workaround for this scenario is to temporarily disable or remove the 'after undelete' trigger(s) on Leads.
We can set the Debug Log to capture which processes are preventing the record to be undeleted. This will allow you to accurately locate what is the root cause of the issue.