Gearset has recently introduced a new workflow to allow you to restore deleted records and any related child records that were removed as a result of that deletion. The new workflow will allow you to build up a restore plan starting with a base object and then you can select the records of child objects (and grandchild / child-of-child objects) you want to restore.

A common example of this would be an Account record that was deleted. The cascading nature of the Salesforce's deletion logic means that all the Opportunities on the Account and the OpportunityLineItems (listed as Products on the Opportunity) will also be deleted. The new restore flow will allow you to restore all of these items in a single restoration deployment.

How to use the new workflow

The new workflow can be accessed via the run details page through the Restore deleted records button. This will only appear for records where you have deleted records in this run.

Clicking this button will select this object as the Base object where we will can build up a restoration plan.

When you come into the Restore from [Base object] page, we will show the Base object along with the first level of child relationships.

If you expand the relationship it will then populate with the next level of relationships:

Note that by default we only show objects with non-zero counts of records. If you want to see the relationships where there are no deleted records, you can click the Show unchanged records button:

As there can be many relationships which do not have any unchanged records, we hide these by default, but it can be useful to check to confirm that no related records were deleted along with the Base object records.

You are also able to filter on the Base object, by clicking the filter icon in the Total records to restore column:

This will bring up a similar filter dialog to those used in data deployments or browsing backed up records:

Once you apply this filter to the Base Object it will also update the record counts for the related child objects:

Once you have selected the records you want to include, you can create a restore plan by clicking the Preview restore button:

Once the plan is created, you will be brought to the data deployment summary page, similar to what you would see on the final stage of a data deploy / restore:

Click Deploy data to deploy to restore back to your org:

Your records should now have been restored to your org.

Notes:

  • We currently don't support deployment of objects with binary fields such as Attachments or ContentVersion records but we are looking to add this functionality in the near future

  • We do not support restoring children of the same object type: eg. Child Accounts, we are looking to add this functionality in at a later stage

Example: Restoring a deleted Account along with its Opportunities and OpportunityLineItems

We will now walk through an example of how you can restore a fairly simple deletion using this new workflow. The example we use is for the deleted records of some standard Salesforce objects: Account, Opportunity and OpportunityLineItem. Note: This workflow also works for most object and their child relationships, see below.

The relationship here is Account has child Opportunities; Opportunities have child OpportunityLineItems. Viewing this on the Schema builder in Salesforce (OpportunityLineItems are shown as Opportunity Products):

In a simpler form, where the arrows point from a parent record to a child record:

Here is an example in Salesforce:
We have an Account with two Opportunities on it:

One Opportunity has 3 OpportunityLineItems (shown as Products):

Another Opportunity has 4 OpportunityLineItems (shown as Products):

This Account then gets deleted. On the next data backup run, we see that we have the deleted Account along with its 2 Opportunities and 7 OpportunityLineItems. We select Restore from deleted, using the deleted Account as the Base object (red box).

When we open the Restore from Account page, the Child relationships are populated. We can see the Account object has Opportunities as a child:

We then expand the Opportunities to get the OpportunityLineItems:

We then select the Account, Opportunity and OpportunityLineItems and click Preview restore to plan a restoration:

This will create a plan where we can deploy the data:

We then click Deploy data to restore the data:

Once it has completed we can view the restored records in Salesforce:

Restoring with a custom setup

Even though the example above is for standard Salesforce objects, you can restore in a similar way for many different setups. For example the same process could be used for an org with custom objects with child and grandchild relationships:

Future plans and feedback

We are always looking to improve the product and want to work on features that offer the most value to customers. If you have any feedback of how we can improve this workflow or new functionality we can add let us know through the in app chat. We look forward to hearing from you!

Did this answer your question?