Delete Items, Customers, or Vendors
In this topic we’ll cover how to perform a bulk delete on a list of items, although the same process can be followed for customers or vendors using the appropriate pages.
From the Item List page, select the records you wish to delete either by selecting multiple records as shown in the following image or applying a filter to match the records you want to delete.
From the Actions, select the Bulk Delete option. The system will create a new bulk delete request using the information you selected and show you the Bulk Delete Request Card.
The system has converted the records you selected into a filter for the No. field on the Item table. You can see that the Filtered Records Count field shows a count of four records to be deleted.
Once you are ready to proceed and delete the records, click the Delete Now action.
The system will display a confirmation dialog to ensure you really want to delete the selected records.
Select Yes to continue with the delete. The system will attempt to delete each record in turn and record whether the delete succeeded or failed. You can see the results in the Deleted Records FactBox.
You can review the reasons why the records failed to delete by clicking the drill down on the Failed to Delete cue to see the Delete Requests page.
If you are finished with the Bulk Delete Request, you can return to the Bulk Delete Request Card and delete the record. This will prompt for deletion.
Select the Yes button and the system will delete the Bulk Delete Request record and the associated filter lines and results records.
Bulk Delete Any Table
As well as creating bulk delete requests from the Items, Customers, and Vendors list pages, you can create a new Bulk Delete Request and pick from any of the available tables.
Search for the Bulk Delete Requests page. You should see a list of all the Bulk Delete Requests you have previously created. The page is filtered to only show requests that you created, but you can select the All Requests action to show requests created by other users.
Click the New button to create a new bulk delete request.
A new bulk delete request is created. If you know the Table Id, type the number in to the Table Id field, or use the drop-down to select from a list.
The Filtered Records field will update to show the number of records that match your existing filter. To set filters, click in to the Filters sub-page and use the assist button to select from the list of available fields.
Once you have selected the field number, enter a filter that should be applied to this field.
Notice how the Filtered Records Count has changed to reflect the number of records that match the filters you have created.
Now continue as normal and use the Delete Now action as described in the previous usage scenario.
For Developers
If you want to add the Bulk Delete action to your own extensions, you can simply add the Bulk Delete app as a dependency to your project as follows.
{
"id": "f6ed7976-9eb2-4854-b0e3-ab8a4a3f23ea",
"name": "Bulk Delete",
"publisher": "BC Apps Limited",
"version": "1.0.0.0"
}
Then on the list page, simply add the following action.
actions
{
addlast(processing)
{
action(BC_BulkDelete)
{
Caption = 'Bulk Delete';
Ellipsis = true;
ToolTip = 'Triggers the deletion of the filtered or selected records.';
Image = DeleteRow;
ApplicationArea = All;
trigger OnAction()
var
ItemToDelete: Record Item;
BulkDeleteRequest: Record BC_BulkDeleteRequest;
BulkDeleteManager: Codeunit BC_BulkDeleteManager;
begin
CurrPage.SetSelectionFilter(ItemToDelete);
if ItemToDelete.Count() = 1 then begin
ItemToDelete.Reset();
ItemToDelete.CopyFilters(Rec);
end;
if BulkDeleteRequest.Get(BulkDeleteManager.CreateBulkDeleteRequest(ItemToDelete)) then
Page.Run(Page::BC_BulkDeleteRequestCard, BulkDeleteRequest);
end;
}
}
}