You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Web API, you can retrieve records using FetchXml or OData syntax.
74
74
75
75
> [!NOTE]
76
-
> Currently, you can only retrieve deleted records using FetchXml.
76
+
> Currently, with Web API you can only retrieve *deleted* records using FetchXml.
77
+
78
+
When you retrieve data using FetchXml, set the [fetch element](fetchxml/reference/fetch.md)`datasource` attribute to '`bin`' when you retrieve records.
77
79
78
80
This `Get-DeletedAccountRecords` PowerShell function returns up to three deleted account records.
79
81
@@ -290,9 +292,16 @@ function Restore-AccountRecord {
290
292
291
293
---
292
294
293
-
### Errors that might occur when restoring records
295
+
### Best practices when restoring records
296
+
297
+
The following are issues you can avoid when restoring records:
298
+
299
+
-[Restore related records before restoring primary record](#restore-related-records-before-restoring-primary-record)
300
+
-[Don't specify primary key values when creating records](#dont-specify-primary-key-values-when-creating-records)
301
+
-[Records with matching alternate key values will block restore](#records-with-matching-alternate-key-values-will-block-restore)
302
+
-[Records using removed Choice options can't restored](#records-using-removed-choice-options-cant-restored)
303
+
-[Primary Key Violation on Delete](#primary-key-violation-on-delete)
294
304
295
-
The following errors might occur when restoring records.
296
305
297
306
#### Restore related records before restoring primary record
298
307
@@ -334,7 +343,7 @@ If you delete an optionset option, and that option was used in a deleted record,
334
343
335
344
#### Primary Key Violation on Delete
336
345
337
-
If the record with same primary key was already deleted before, copy to Recycle Bin is ignored for the record. To enforce all deleted items are stored in Recycle Bin, you can set the `DoNotEnforcePrimaryKeyOrgSettingRecycleBin` setting using the [OrgDBOrgSettings tool for Microsoft Dynamics CRM](/power-platform/admin/environment-database-settings).
346
+
If the record with same primary key was already deleted before, copy to recycle bin is ignored for the record. To enforce all deleted items are stored in recycle bin, you can set the `DoNotEnforcePrimaryKeyOrgSettingRecycleBin` setting using the [OrgDBOrgSettings tool for Microsoft Dynamics CRM](/power-platform/admin/environment-database-settings).
338
347
339
348
After enabling this setting, you might receive the following error:
340
349
@@ -525,7 +534,7 @@ function Set-CleanupIntervalInDays{
525
534
To disable the recycle bin for a table, disable the `recyclebinconfig` record for the table by setting the [statecode](reference/entities/recyclebinconfig.md#BKMK_statecode) and [statuscode](reference/entities/recyclebinconfig.md#BKMK_statuscode) properties to their **Inactive** values: `2` and `1` respectively.
526
535
527
536
> [!NOTE]
528
-
> The following queries compare the `EntityId` value against the [Entity.EntityId](reference/entities/entity.md#-entityid) column value, which stores the table `EntityId`.
537
+
> The following queries compare the `EntityId` value against the [Entity.EntityId](reference/entities/entity.md#-entityid) column value, which stores the table [EntityMetadata.MetadataId ](/dotnet/api/microsoft.xrm.sdk.metadata.metadatabase.metadataid).
@@ -605,12 +622,12 @@ function Disable-RecycleBinForTable {
605
622
-setName 'recyclebinconfigs' `
606
623
-id $recyclebinconfigId `
607
624
-body @{
608
-
'statecode' = 1
609
-
'statuscode' = 2
610
-
} | Out-Null
625
+
'statecode' = 1
626
+
'statuscode' = 2
627
+
} | Out-Null
611
628
}
612
629
else {
613
-
Write-Host "Recycle bin configuration for table '$tableLogicalName' not found."
630
+
Write-Host "Recycle bin configuration for table $tableId not found."
614
631
}
615
632
}
616
633
```
@@ -652,11 +669,12 @@ If you have this kind of custom business logic, then Dataverse doesn't know abou
652
669
653
670
> [!IMPORTANT]
654
671
> Be careful about the context when you register plug-in steps for the `Restore` message. The record being restored will not be available in the `PreOperation` stage. If related records need to be created, use the `PostOperation` stage. [Learn more about plug-in stages](event-framework.md#event-execution-pipeline).
672
+
>
655
673
> The [InputParameters](understand-the-data-context.md#inputparameters) and [OutputParameters](understand-the-data-context.md#outputparameters) of the `Restore` message are similar to `Create` message, so plug-ins written to be registered for the `Create` message can be re-used for the `Restore` message with fewer changes.
656
674
657
675
## Tables not currently supported for Recycle Bin
658
676
659
-
The following tables are the result of the query found in [Detect which tables don't have recycle bin enabled](#detect-which-tables-dont-have-recycle-bin-enabled) in May of 2024 when the preview of this feature started.
677
+
The following tables are the result of the query found in [Detect which tables don't have recycle bin enabled](#detect-which-tables-dont-have-recycle-bin-enabled) in May of 2024 when the preview of this feature started.[Private tables](entities.md#private-tables) are not included in this list.
0 commit comments