---
id: change/bcapps/10207
type: change
title: "#10207 [Dataverse] Use Truncate for CRM Integration Record cleanup during environment copy"
summary: 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.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit cds integration impl.
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:08:11.545Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 3bd81252fba72725c022234528311414d4da35ec
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10207
    title: "microsoft/BCApps#10207: [Dataverse] Use Truncate for CRM Integration Record cleanup during environment copy"
    date: "2026-08-19"
    commit: 3bd81252fba72725c022234528311414d4da35ec
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/7201
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10207
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10207
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-19T20:07:08Z"
author: onbuyuka
author_type: User
community_contribution: false
labels:
  - "Team: Integrations"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 3
  additions: 172
  deletions: 5
  al: 1
apps:
  - Base Application
objects_touched:
  - key: codeunit/7201
    page: codeunit/7201
    type: codeunit
    id: 7201
    name: CDS Integration Impl.
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 646451
systems:
  - integration
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #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](https://github.com/microsoft/BCApps/pull/10207) · 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

- [Codeunit 7201 "CDS Integration Impl."](../../objects/codeunit/7201.md), Base Application: modified

## 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).
