# Recycle Bin on Dataverse (Preview)

## Recovering Deleted Data in Microsoft Dataverse

In Microsoft Dataverse, records or transactions can be deleted through various means - manually by users, automatically by system processes, or through bulk deletion actions. These deletions can occur intentionally or accidentally

The challenge lies in the recovery of deleted data. Historically, **restoring records in Dataverse** could be difficult, with some data potentially being permanently lost. To mitigate this issue, Microsoft provides a solution: the **Recycle bin.**

The **Recycle bin in Microsoft Dataverse** is designed to recover table record data regardless of how it was deleted—covering all deletion scenarios. This feature operates within a flexible, configurable timeframe, ensuring that users have a window in which they can retrieve their lost data.

Okay.. now\.. let's try this preview feature with me! :thumbsup:

## Enabling the "Recycle Bin" for an environment

In the Power Platform Admin Center > Setting > under the Feature setting: ***Enable Recycle bin for Dataverse table*** and specify the ***Time interval*** as below.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2F1tEXMQOA3dC6yZkKpuoc%2FCleanShot%202024-05-11%20at%2022.37.26%402x.png?alt=media&#x26;token=1e1bb2c0-d5ad-40df-b105-979780981885" alt=""><figcaption><p>Enabling the Recycle bin for Dataverse tables</p></figcaption></figure>

Next, wait at least 10 minutes for the configuration process to complete.

## How to restore deleted records?

<mark style="color:red;">**Restore deleted records:**</mark>

To restore deleted records, you go back to the Power Platform Admin Center > Select the environment and click **Setting**. After that, under **Data Managemen**t > click **"View Deleted Record (Preview).**&#x20;

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2Fv7uUObBJrgYB2malZlRm%2FCleanShot%202024-05-11%20at%2023.02.47%402x.png?alt=media&#x26;token=9e2f722c-d938-483d-b266-88ceb415d43a" alt=""><figcaption><p>View Deleted Record (Preview)</p></figcaption></figure>

The system will show all deleted records and you can select one or multiple records that need to be restored. After that, click the button **Restore** to **recall data.**

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FgeVwXtxbb5jDye3r3qxc%2FCleanShot%202024-05-11%20at%2023.08.54%402x.png?alt=media&#x26;token=8eb1531c-f774-4841-82fe-ec83b45c9cf9" alt=""><figcaption><p>Restoring selected record</p></figcaption></figure>

and then, checking the record after restoring.

## Testing now\...

I will test my environment (without D365 Applications). I will separate the test case for data checking after restoring deleted records.

For instance, I will check on 2 entities:

* Parent entity: **Account**
* Child entity: **Deal**
* &#x20;The relationship: **Account&#x20;**<mark style="color:red;">**(1:n)**</mark>**&#x20;Deal**

<details>

<summary><mark style="color:red;">Test Case 1:</mark> Delete the child entity "Deal" with the lookup field "Account" containing data.</summary>

Expectation after **restoring** **deleted** **Deal** record: The ***Account*** field will be restored with the original data

<mark style="color:green;">**Before deleting:**</mark> Deal record - the Account field contains value "NTD Asia Corp"

<img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FXwq8cAOXN8iWDSsqDPIO%2FCleanShot%202024-05-11%20at%2023.00.00%402x.png?alt=media&#x26;token=65f9369c-8c8a-4c2e-ae25-28afa9a93cb6" alt="" data-size="original">

<mark style="color:green;">**After Restoring:**</mark> The testing passed. The Deal record has been restored successfully with the original Account field value.

<img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FzQMwyRs1tqgAfhQYDLVs%2FDelete_Restore_Child_Deal_entity.gif?alt=media&#x26;token=68ec16a9-bc81-492b-8848-c46b4efa9b71" alt="" data-size="original">

</details>

<details>

<summary><mark style="color:red;">Test Case 2:</mark> Delete the parent entity "Account" associated with the Deal records.</summary>

I have 2 Deal records associated with the Account **"Hoang Quan Corp."** -> After deleting the Account "Hoang Quan Corp.", this value has been removed from 2 related Deal records before.

<img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FdwJxhePAOo1fxggiIagA%2FCleanShot%202024-05-11%20at%2023.21.09%402x.png?alt=media&#x26;token=c03e290a-a755-4efd-bbb3-c1ede74e0c4e" alt="" data-size="original">

Now, after **restoring the Account "Hoang Quan Corp."**, I hope that this value will be associated with Deal records before.

<mark style="color:green;">**After restoring:**</mark> The Account "Hoang Quan Corp." has been restored and associated with 2 Deal records before. -> The testing passed.

<img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2Fl6BCvjsZMAfzmOFBm9gb%2FDelete_Restore_Parent_Account_entity.gif?alt=media&#x26;token=60691e95-26a8-4c7a-8bf1-24d683c2d3d8" alt="" data-size="original">

</details>

Thank you for reading & Hoping well! :tada:\
\&#xNAN;**\[NTD]yns.asia**
