The netherworld of deleted records not in recycle bin

Trying to uninstall a package – but one lonely record refers to RecordType in that package, and so long as that is the case, I can’t remove the package. But that record is deleted, and not available in Recycle Bin.

So this query actually returns the record:

[Select Id, IsDeleted, RecordTypeId, LastModifiedDate from Contact where Id = 'XXX' all rows];

But when I try and undelete the record, it won’t let me, and I can’t update it…

Do I have any options other than wait for SFDC to finally purge it? It was deleted on Oct 30th, so how much longer will I need to wait?

Answer

Deleting a parent record can also delete its children records. For example, deleting accounts also deletes contacts. If you search the for the child record in the recycle bin, it won’t appear in the list. You can query for it, but you’ll get an error “Entity is not in the recycle bin” if you try to undelete it. Restoring the parent record also restores the children records. Purging the parent also irrevocably deletes the children records; this is what salesforce is expecting you to do before you can uninstall the package. Edit: It occurred to me that it’s important to note an important aspect here: If you can query it in Apex Code or the Data Loader, it’s either active or soft-deleted. Hard deleted records only appear in the replication API, and only for 30 days. Normal Apex Code can’t query hard-deleted data, so the fact that you can still see it means it is still only soft-deleted.

Attribution
Source : Link , Question Author : BritishBoyinDC , Answer Author : sfdcfox

Leave a Comment