code change · performanceIntegration & APIsofficial - Microsoftreviewed - checked by Opus

#10207 [Dataverse] Use Truncate for CRM Integration Record cleanup during environment copy

Environment copy cleanup of CRM Integration Records now uses bulk truncate instead of row-by-row deletion to improve performance on large coupling tables, with fallback to the original DeleteAll method when truncate is unsupported.

Pull request · merged into main (BC30) on 2026-08-19 by onbuyuka · 3 files (+172 -5), 1 AL · performance · tier official · reviewed (checked by Opus)

What changed

  • Switches CleanCDSIntegration from DeleteAll() to Record.Truncate() for faster bulk cleanup
  • Falls back to DeleteAll only when truncate is unsupported (delete-event subscriber or security filter present)
  • Preserves ChangeCompany scoping and OnBeforeCleanCRMIntegrationRecords hook behavior
  • Optimizes TableKey.DisableAll to run only on slow fallback path
  • Adds comprehensive test coverage for truncate, fallback, and ChangeCompany scenarios

AL objects touched

Context

  • Work items: AB#646451
  • Labels: Team: Integrations
  • Systems: integration

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).