Loading...

Recycle Bin Dataverse

Recycle Bin Dataverse
Recycle Bin Dataverse joao.neto Thu, 07/04/2024 - 14:40
Body

Intro

Have you deleted some Dataverse records accidentally and you're struggling how to managed it ?

The new Recycle Bin feature in preview might be what it solves your problem.

It allows Administrator only (in the preview version) to recover user deleted records up to 30 days!

How it Works

First we need to ensure that the feature is activated doing it this way_

  • Going to the Settings -> Product -> Features in the admin center
  • setup
  • Trying to set a recovery interval bigger that 30 days will fail !

 

Second to view and restore the deleted records:

  • Go to your environment Settings -> Data Management -> View Deleted Records
  • view deleted records
  • And in this view will be able to view and restore all deleted records
  • view deleted records

Third, you can also use the Organisation Service in .net or the WebApi to:

  • Retrieve deleted records (web api example)
$query = @()
   $query += ""
   $query += ""
   $query += ""
   $query += ""
   $query += ""

   $uri = $environmentUrl
   $uri += 'accounts'
   $uri += '?fetchXml=' + [uri]::EscapeUriString($query -join '')

   $RetrieveMultipleRequest = @{
      Uri     = $uri
      Method  = 'Get'
      Headers = $baseHeaders
   }
   Invoke-RestMethod @RetrieveMultipleRequest

 

  • Restore deleted records (.net example)
/// 
/// Restores an account record
/// 
/// The authenticated IOrganizationService instance
/// The ID of the deleted account record.
/// The original name value for the account record.
/// The ID of the restored account
static Guid RestoreAccountRecordEarlyBound(
    IOrganizationService service, 
    Guid accountId,
    string originalName)
{
    Account accountToRestore = new()
    {
        Id = accountId,
        // Appending '(Restored)' to the original name
        // to demonstrate overwriting a value.
        Name = originalName + " (Restored)"
    };

    RestoreRequest request = new()
    {
        Target = accountToRestore
    };

    var response = (RestoreResponse)service.Execute(request);
    return response.id;
}

Points in atenttion

 

Final thoughts

The Dataverse Recycle bin it's a must to regarding business data recovery and we can't wait for the final announce of it's general availability.

 

 

Image
/sites/default/files/2024-08/Cover.png

Published on:

Learn more
Featured Articles | Dynamics Chronicles
Featured Articles | Dynamics Chronicles

Welcome to our blog, the content is entirely dedicated to Microsoft Dynamics 365, CRM, Power Platform, Common Data Service (CDS) but also Azure. Follow us !

Share post:

Related posts

Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy