I have tried to undelete a record, both in the Recycle Bin UI and via apex.

The UI message is cryptic (4 potential explanations), but the apex debug gives me the following:

DEBUG|Undelete failed. First exception on row 0 with id a0N3000000AfFu8EAF; first error: UNDELETE_FAILED, This object was part of an entity whose definition has been deleted.: []

I have millions of these records, and the object is NOT deleted.

Anyone seen this before? I'd love to have my record back!

  • Does it have a lookup relationship to an Sobject whose definition has been deleted? Note you can query this object through SFDC Workbench (check the box to include deleted records) and look at all the fields to perhaps give you a better clue as what makes this object 'special'. You could also try creating a sample dummy record of this object, delete it, and see if you can undelete it. – cropredy Apr 22 '14 at 21:38
  • Crop, No objects have been deleted since the record was last edited. – Shane McLaughlin Apr 23 '14 at 0:05

According to my knowledge, This issue was fixed in spring release.

Reason: Recycle bin is not usable when a truncated entity gets assigned to a keyprefix that was the old keyprefix of a previously truncated entity

Steps to reproduce:

1> create custom entity A(a00), B(a01) and C(a02).

2> truncate A and B

3> erase the soft deleted A_trunc1 and B_trunc1

4> truncate C Notice C gets assigned the prefix a00

now create a record for C and delete it the record cannot be found in recycle bin

If you still see the issue, a temporary workaround is to manually export the data using WORKBENCH. use the checkbox to include deleted+ archived records and export the data which you need and import them back into salesforce.


Did you try to :

  1. Query your records with IsDeleted = True ALL ROWS
  2. Export your records through DataLoader with Delete = true?

Somehow, your schema has been changed and it doesn't match with your deleted records anymore. For example, if you added a required field or a unique field in your object after having deleted your records. The thing to do is to try to replicate how your object was before:

  • Make your fields not required
  • Make your fields not unique
  • Recreate any fields your might deleted.
  • ...

There is manipulations to do and you should be able to achieve this if you know your data model.

Good luck.

  • Nothing changed about the data model since the record was last edited. – Shane McLaughlin Apr 23 '14 at 0:06
  • Did you have a formula field which reference a deleted field from a related object or something like that? Your problem might not be on the object itself but on a parent or children – Cloud Ninja Apr 23 '14 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.