Rozšíření pro Microsoft Dynamics 365 Business Central, které pomáhá zjistit, co zabírá místo ve vaší databázi, a bezpečně to promazat.
English version below / anglická verze níže
Business Central tenant časem přirozeně roste — a hlavním důvodem bývají uložené soubory: obrázky na kartách, přílohy dokladů a stále častěji i e-maily (například ty, které do systému stáhne funkce Payables Agent při sledování schránky s příchozími fakturami). Všechna tato data se ukládají do sdílené tabulky Tenant Media a mohou vás dostat přes limit databázové kapacity, který vidíte na stránce Capacity v administračním centru Business Central.

Database Cleaning Data vám ukáže, co přesně místo zabírá, a umožní staré nebo nepotřebné soubory bezpečně, dávkově a podle vámi zvolené doby uchování smazat.
Všechny stránky a reporty aplikace najdete v menu Business Central pomocí funkce Řekněte mi (ikona lupy / klávesová zkratka Alt+G) — stačí napsat část názvu, např. "tenant" nebo "vyčištění".

Než cokoliv smažete, doporučujeme spustit Diagnostika Tenant Media (Tenant Media Diagnostics). Report projde tabulku Tenant Media a zjistí, co v ní reálně zabírá místo — nejde jen o "ztracené" soubory, ale i o aktivně používaná, avšak neúměrně objemná data.
Při spuštění zvolíte rozsah, který se má analyzovat:
Výsledkem je CSV soubor, který se stáhne do vašeho počítače:

Pokud chcete zjistit, co konkrétní záznam z tohoto seznamu obsahuje (u řady záznamů chybí název souboru), použijte stránku Náhled Tenant Media (Tenant Media Preview) — stačí vložit ID záznamu ze sloupce Sample Id a stránka zobrazí obrázek nebo soubor i s jeho základními údaji.

Samotná diagnostika nic nemaže — jde čistě o přehled, na jehož základě se rozhodnete, co dál.
Report Vyčištění dat (Data Cleanup) najdete stejně přes Řekněte mi:

Slouží k pravidelnému, dávkovému promazávání starých záznamů. Stránka je rozdělená na sekce podle jednotlivých typů dat, u každé je přímo na obrazovce krátké vysvětlení, co obsahuje. U každé sekce zapnete mazání zaškrtnutím a zadáte, jak staré záznamy se mají smazat (např. 3 měsíce, 1 rok) — novější záznamy zůstanou vždy zachovány.
Document Attachment / Incoming Document Attachment — přílohy přidané k dokladům a kartám v celém Business Central.

Email Inbox — skutečný seznam přijatých a odeslaných e-mailů v nativní funkci Email, včetně pošty stažené funkcemi jako Payables Agent.

Email Message — doplňkový úklid "osiřelých" e-mailů, které už na nic neodkazují; s promazáním Email Inbox se běžné e-maily i jejich přílohy uvolní automaticky, tahle volba jen dočistí zbytek.

Kromě jednotlivých tabulek stránka obsahuje i společné volby:

Před ostrým mazáním doporučujeme zaškrtnout Jen spočítat — report pak jen ukáže, kolik záznamů by smazal, aniž by cokoliv skutečně odstranil. Po odškrtnutí této volby se před samotným mazáním vždy zobrazí potvrzovací dialog s přehledem počtů:

Po dokončení report zobrazí souhrn, kolik záznamů skutečně smazal:

Po smazání příloh se uvolněné místo v Tenant Media neprojeví hned — doporučujeme následně spustit standardní funkci Business Central Správa dat → Odstranit nepřipojená média, aby se skutečně uvolnila velikost databáze.
Report najdete opět přes Řekněte mi:

Tento report maže záznamy přímo z tabulky Tenant Media — bez ověřování, jestli na ně ještě něco odkazuje. Používejte jen pro záznamy, u kterých už víte (typicky z diagnostiky a náhledu), že jsou nadbytečné.

K výběru záznamů ke smazání máte tři možnosti (vyberte vždy jen jednu):
DELETE ALL.I zde je k dispozici režim Jen spočítat pro náhled dopadu bez mazání a potvrzovací dialog před ostrým smazáním, který výslovně upozorňuje, že akci nelze vrátit zpět.
V produkčním prostředí (mimo Sandbox) je skutečné mazání dat ve výchozím stavu vypnuté — oba výše popsané reporty v produkci nesmažou nic, dokud to administrátor výslovně nepovolí na stránce nastavení aplikace:
CONFIRM PRODUCTION DELETION.Dokud toto není povoleno, ostré mazání v produkci skončí srozumitelnou chybovou hláškou. Režim Jen spočítat tímto omezením není nijak dotčen a funguje vždy. Ve Sandbox prostředí toto omezení neplatí.
Oba reporty lze nastavit i jako pravidelně se opakující úlohu (frontu úloh) v Business Central, takže se čištění dat může provádět automaticky na pozadí bez nutnosti je spouštět ručně.
Licenční kód zadáte na stránce nastavení aplikace (najdete ji přes Řekněte mi pod názvem Database Cleaning Data Setup).
V případě dotazů, zájmu o licenci nebo technické podpory nás kontaktujte na helpdesk(at)navitec.cz.
Česká verze výše / Czech version above
Business Central tenants tend to grow quietly over time — usually because of stored files: pictures on cards, attachments on documents, and increasingly emails (for example, mail downloaded by the Payables Agent while watching an inbox for incoming invoices). All of this ends up in the shared Tenant Media table and can push you past the database capacity limit shown on the Capacity page in the Business Central admin center.

Database Cleaning Data shows you exactly what's taking up the space, and lets you safely remove old or unneeded files in controlled batches, using a retention period you choose.
All of the app's pages and reports can be found in the Business Central menu via Tell me (the magnifying-glass icon, or Alt+G) — just type part of the name, e.g. "tenant" or "cleanup". (Screenshots in this guide show the Czech menu labels; the English UI shows the equivalent English names.)

Before deleting anything, we recommend running Tenant Media Diagnostics. It scans the Tenant Media table to find out what is actually taking up space there — not just "orphaned" files, but also actively used data that has simply grown too large.
When you run it, you choose a scope:
The result is a CSV file, downloaded to your computer:

If you want to see what a specific record from that list actually contains (many records have no file name shown), use the Tenant Media Preview page — enter the record's ID from the Sample Id column and the page will display the image or file along with its basic details.

Diagnostics never deletes anything — it's purely a report to help you decide what to do next.
Find the Data Cleanup report the same way, via Tell me:

It handles regular, batched deletion of old records. The page is organized into sections by data type, each with a short on-screen explanation of what it contains. For each section, tick the box to enable deletion and enter how old records must be before they're removed (e.g. 3 months, 1 year) — newer records are always kept.
Document Attachment / Incoming Document Attachment — attachments added to documents and cards throughout Business Central.

Email Inbox — the actual list of received and sent emails in the native Email feature, including mail downloaded by features such as the Payables Agent.

Email Message — a supplementary cleanup of "orphaned" emails that nothing refers to anymore; deleting Email Inbox records already releases the underlying emails and their attachments automatically, so this option just tidies up any leftovers.

Besides the individual tables, the page also has shared options:

Before deleting for real, we recommend ticking Count Only — the report then just shows how many records would be deleted, without removing anything. Once that's unticked, a confirmation dialog with the record counts always appears before deletion actually happens:

Once finished, the report shows a summary of how many records were actually deleted:

Freed space in Tenant Media doesn't shrink the database immediately after attachments are deleted — afterwards, run Business Central's standard Data Administration → Remove Detached Media function so the freed space is actually reclaimed.
Find this report the same way, via Tell me:

This report deletes records directly from the Tenant Media table, without checking whether anything still references them. Only use it for records you already know (typically from diagnostics and the preview page) are redundant.

You choose one of three ways to select the records to delete:
DELETE ALL exactly into the confirmation field.A Count Only preview mode is available here too, along with a confirmation dialog before real deletion that explicitly warns the action cannot be undone.
In a production environment (as opposed to a Sandbox), real deletion is disabled by default — neither report will delete anything in production until an administrator explicitly enables it on the app's setup page:
CONFIRM PRODUCTION DELETION.Until this is enabled, any attempt at real deletion in production stops with a clear error message. The Count Only preview mode is never affected by this and always works. This restriction does not apply in a Sandbox environment.
Both reports can also be set up as a recurring job queue entry in Business Central, so cleanup can run automatically in the background without anyone having to start it manually.
Enter your license code on the app's setup page (find it via Tell me under Database Cleaning Data Setup).
For questions, licensing, or technical support, contact us at helpdesk(at)navitec.cz.