10+ years ago I created a Record Deletion tool for Dynamics NAV that I published here on my blog.
It was a tool that could be used to clean up test transactions in a company in Dynamics NAV, and it quickly became very popular. People have reach out to about getting this tool available for Business Central (I also think some have done the work of converting this tool into a BC extension themselves). So here we go; it is now available via AppSource and can be accessed for FREE here:
Record Deletion Tool for Business Central
The functionality is the same as back in the days, so reading the old blog post about the Record Deletion Tool for Dynamics NAV 2015 would give you an idea of how it is working and what it can be used for (if you have not tried it yet).
It looks like below, same functionality, different look.

In addition, it is now also extendable, you can add code to make your own tables defaults in the suggestion of what to delete and if you have tables that are protected where record should be deleted then you can handle that as well through extending it.
To add to the list of tables that are included in the suggestion you create a subscriber function like this:
[EventSubscriber(ObjectType::Codeunit, 70666591, 'OnSuggestRecordsToDelete', '', false, false)]
local procedure OnSuggestRecordsToDelete(var IsHandled: Boolean)
var
RecordDeletionTable: Record "NMM RDT Record Deletion Table";
begin
if RecordDeletionTable.GET(DATABASE::"NMM Mobile Entry") then begin
RecordDeletionTable."Delete Records" := true;
RecordDeletionTable.Modify();
end;
if RecordDeletionTable.GET(DATABASE::"NMM Mobile Mfg. Time Entry") then begin
RecordDeletionTable."Delete Records" := true;
RecordDeletionTable.Modify();
end;
end;
And to delete records from a protected table that’s not already part of the tool you create a codeunit like the one below (note the permissions in the top part of the codeunit, that’s the key piece of why you need this a separate codeunit).
codeunit 50100 "Sample Record Deletion Add."
{
Permissions =
tabledata "NMM Mobile Entry" = D,
tabledata "NMM Mobile Mfg. Time Entry" = D;
[EventSubscriber(ObjectType::Codeunit, 70666591, 'OnBeforeDeleteRecordsFromTable', '', false, false)]
local procedure OnBeforeDeleteRecordsFromTable(TableId: Integer; var IsHandled: Boolean)
var
RecRef: RecordRef;
begin
if TableId = DATABASE::"NMM Mobile Entry" then begin
RecRef.Open(TableID);
RecRef.DeleteAll();
RecRef.Close();
IsHandled := true;
end;
if TableId = DATABASE::"NMM Mobile Mfg. Time Entry" then begin
RecRef.Open(TableID);
RecRef.DeleteAll();
RecRef.Close();
IsHandled := true;
end;
end;
}
I have also made a video walking through the tool. Making videos like this is harder than it looks, but at least I tried. 🙂
And here is the documentation related to this tool: https://naviona.com/docs/record-deletion-tool/
As with other things on my blog, you can use this as you want, free of charge, but at your own risk. 🙂 Make sure to copy the company or have some kind of backup plan before you start deleting records.
Also, if you find tables that should be parts of the suggestion to delete records from then let me know and I will add them. I am sure there are newer tables that I have missed..
Cheers!
Discover more from Olof Simren - Microsoft Dynamics 365 Business Central Blog
Subscribe to get the latest posts sent to your email.






3 Comments
Leave your reply.