---
id: change/bcapps/13005
type: change
title: "#13005 [Master Data Management] Cleanup when copying environment"
summary: Master Data Management now performs cleanup when an environment is copied, via changes to its subscribers, HTTP source transport and setup table. The description rates the risk as low because live tenants do not use the feature yet.
tier: official
language: en
tags:
  - feature
  - main
  - bc30
  - codeunit mdm http source transport
  - codeunit master data mgt. subscribers
  - table master data management setup
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-21T00:48:36.872Z"
  flags: []
generated:
  at: "2026-11-14T00:13:17.671Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 7dc38deea4516e1a0645ea9829ec095dcb7464d0
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/13005
    title: "microsoft/BCApps#13005: [Master Data Management] Cleanup when copying environment"
    date: "2026-10-20"
    commit: 7dc38deea4516e1a0645ea9829ec095dcb7464d0
    t: null
    quote: We should do cleanup before environment gets copied
links:
  learn:
    - https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/tenant-admin-center-environments-copy
  objects:
    - object/codeunit/7247
    - object/codeunit/7237
    - object/table/7230
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/tenant-admin-center-environments-copy
      title: Copy a Business Central Environment
      label: documents
      why: changes what is cleaned up when an environment is copied (Master Data Management)
      by: override
    - to: object/codeunit/1886
      title: Codeunit 1886 "Environment Cleanup"
      label: possibly related
      why: touches Codeunit 7237, which subscribes to OnClearCompanyConfig (data/index/events.json, BC29)
      by: override
number: 13005
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/13005
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-20T16:44:36Z"
author: dcenic
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Finance"
change_class: code
change_kind: feature
behavior_change: true
breaking: false
files:
  count: 5
  additions: 171
  deletions: 14
  al: 3
apps:
  - MasterDataManagement
objects_touched:
  - key: codeunit/7247
    page: codeunit/7247
    type: codeunit
    id: 7247
    name: MDM Http Source Transport
    app: MasterDataManagement
    status: modified
  - key: codeunit/7237
    page: codeunit/7237
    type: codeunit
    id: 7237
    name: Master Data Mgt. Subscribers
    app: MasterDataManagement
    status: modified
  - key: table/7230
    page: table/7230
    type: table
    id: 7230
    name: Master Data Management Setup
    app: MasterDataManagement
    status: modified
objects_unjoined: []
obsoletions: []
backports:
  - number: 13016
    base: releases/29.x
    url: https://github.com/microsoft/BCApps/pull/13016
fixes_issues: []
work_items:
  - 655932
systems:
  - integration
quote: We should do cleanup before environment gets copied
joined_against:
  major: "30"
  commit: eb2bfe5258a473c969a6b85cdc98ce8524408706
---

# #13005 [Master Data Management] Cleanup when copying environment

> Master Data Management now performs cleanup when an environment is copied, via changes to its subscribers, HTTP source transport and setup table. The description rates the risk as low because live tenants do not use the feature yet.

[Pull request](https://github.com/microsoft/BCApps/pull/13005) · merged into `main` (BC30) on 2026-10-20 by dcenic · 5 files (+171 -14), 3 AL · feature · tier official · reviewed (checked by Opus)

## What changed

- Cleanup runs when an environment gets copied
- Touches Master Data Mgt. Subscribers, MDM Http Source Transport and Master Data Management Setup
- New automated tests added for cross-environment consumer scenarios
- Low risk per author since the feature is not yet used by live tenants
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 7247 "MDM Http Source Transport"](../../objects/codeunit/7247.md), MasterDataManagement: modified
- [Codeunit 7237 "Master Data Mgt. Subscribers"](../../objects/codeunit/7237.md), MasterDataManagement: modified
- [Table 7230 "Master Data Management Setup"](../../objects/table/7230.md), MasterDataManagement: modified

## Also merged into

- [#13016](https://github.com/microsoft/BCApps/pull/13016) into `releases/29.x` on 2026-10-20

## Context

- Work items: AB#655932
- Labels: AL: Apps (W1), Team: Finance
- Systems: integration
- From the description: "We should do cleanup before environment gets copied"

## Linked pages

- [Copy a Business Central Environment](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/tenant-admin-center-environments-copy) — documents: changes what is cleaned up when an environment is copied (Master Data Management) (checked by hand)

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Codeunit 1886 "Environment Cleanup"](../../objects/codeunit/1886.md) — possibly related: touches Codeunit 7237, which subscribes to OnClearCompanyConfig (data/index/events.json, BC29) (checked by hand)

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