I'm working on the restoring records for multiple objects that are stored in my local backup in the form of a database table. There seems to be an issue how the restore works. The scenario is as follows: There are nSObjects that are stored as database tables for backup to be restored (Assuming data that is consistent during the point in time).
For every sObject,
If the sObject can be undeleted and exists in Recycle bin, it can be undeleted.
If the record does not exist in the Recycle bin, I have to find the parentID that exists and restore it first using Bulk API's insert (Please confirm me if this is the only way to restore).
There are a few doubts in the above approach.
- For a record to be undeleted, I have to identify the parent record/object. How do I do that given n sObjects?
- Is undeleting the best way to conserve API limits? The reason is, if I have found out the parent record, why can't I make the approach 2 as a default/generic solution for any restores?
- Is it always true that any related queries in SQL can be developed as:
Parent records: SELECT COLS FROM PARENT
Child records: SELECT COLS FROM CHILD WHERE PARENT.ID IN (CHILD.PARENTID)