🧹 Cleaning and anonymizing copies in Business Central: environments, companies, and traceability
A reusable solution for automatically anonymizing sensitive data, marking copied companies, and adjusting settings when copying Business Central environments or companies. It provides table and field configuration, manual or event-triggered execution, and comprehensive logging for audit trails.

post Gerardo Rentería Blog
"An important part of this idea is not only executing the process, but also leaving evidence of the whole process."
Key points
- Configure which tables and fields to anonymize using setup tables, with options to anonymize selectively across copies
- Leverage standard events (OnClearDatabaseConfig, OnClearCompanyConfig, OnAfterCreatedNewCompanyByCopyCompany) to run cleanup automatically or manually
- Mark copied companies visually with [COPY] tag and adjust configuration settings to distinguish test copies from production
- Log all cleanup executions with header and detail records showing trigger type, company, start/end times, duration, and individual step results for traceability and audit
Quotes
- “An important part of this idea is not only executing the process, but also leaving evidence of the whole process.” (Emphasizes the value of comprehensive logging and traceability for audit, support, and operational review)
AL objects mentioned
As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.
- table “GDRGAnonymizeSetup”
- table “GDRGAnonymizeFieldSetup”
- table “GDRGCleanupSetup”
- table “GDRGCompanyFeatureSetup”
- table “GDRGEnvCopyLog”
- table “GDRGEnvCopyLogLine”
- codeunit “GDRGEnvCleanupMgt”
- codeunit “GDRGEnvCleanupSubscriber”
- codeunit “GDRGDataAnonymizer”
- codeunit “GDRGCompanyMarker”
- codeunit “GDRGPseudonymizer”
- codeunit “GDRGSetupProposalMgt”
- codeunit “GDRGCopyCompanySubscriber”
- codeunit “GDRGCompanyFeatureAdjuster”
- enum “GDRGCleanupOperation”
- page “GDRGAnonymizeSetup”
- page “GDRGAnonymizeFieldList”
- page “GDRGFieldLookup”
- page “GDRGEnvCopyLogList”
- page “GDRGEnvCopyLogLines”
- page “GDRGCleanupSetup”
- page “GDRGCompanyFeatureSetup”
- permissionset “GDRGEnvCleanup”
Not found in BC28-30: table “GDRGAnonymizeSetup”, table “GDRGAnonymizeFieldSetup”, table “GDRGCleanupSetup”, table “GDRGCompanyFeatureSetup”, table “GDRGEnvCopyLog”, table “GDRGEnvCopyLogLine”, codeunit “GDRGEnvCleanupMgt”, codeunit “GDRGEnvCleanupSubscriber”, codeunit “GDRGDataAnonymizer”, codeunit “GDRGCompanyMarker”, codeunit “GDRGPseudonymizer”, codeunit “GDRGSetupProposalMgt”, codeunit “GDRGCopyCompanySubscriber”, codeunit “GDRGCompanyFeatureAdjuster”, enum “GDRGCleanupOperation”, page “GDRGAnonymizeSetup”, page “GDRGAnonymizeFieldList”, page “GDRGFieldLookup”, page “GDRGEnvCopyLogList”, page “GDRGEnvCopyLogLines”, page “GDRGCleanupSetup”, page “GDRGCompanyFeatureSetup”, permissionset “GDRGEnvCleanup”.
Context
- Features: data anonymization by table and field, environment copy cleanup, company copy cleanup, manual cleanup execution, event-based automatic cleanup, company visual marking, configuration adjustment, cleanup execution logging
Source: Gerardo Renteria, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.