Dynamics 365 Business Central: How to delete Comment Lines when combining receipts on a single invoice (Get Receipt Lines)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about in the Dynamics 365 Community, how to delete Comment Lines when combining receipts on a single invoice (Get Receipt Lines). More details: Delete Comment Lines from Puchase Invoice Lines from GetReceiptLine Function (dynamics.com)

As you might know, if you want to invoice more than one purchase receipt at a time, you can select multiple receipt lines on the purchase invoice. Before you can create a combined purchase receipt, more than one receipt from the same vendor in the same currency must be posted. In other words, you must have filled in two or more purchase orders and posted them as received, but not invoiced.

Then on the Purchase Invoices page, choose the Get Receipt Lines action on the Lines FastTab.

Select multiple receipt lines that you want to include in the invoice.

PS: If an incorrect receipt line was selected or you want to start over, you can just delete the lines on the purchase invoice and then use the Get Receipt Lines function again.

There is a small problem here. After getting the Receipt Lines, the system will automatically generate a Commet line to tell the user what the Source Document is. For example, Receipt No. 107209:.

And this data will be brought into the posted data, such as Posted Purchase Invoice and Posted Purchase Invoice Lines.

Let’s look at the standard code. This logic is in the following function:
table 121 “Purch. Rcpt. Line” -> procedure InsertInvLineFromRcptLine:

PS: Text000 is a Label variable. If you translate this in the translation file, the Comment description will also become the local language.

If we want to skip this processing, this requires a simple customization.

Test code:

codeunit 50200 EventHandler
    [EventSubscriber(ObjectType::Table, Database::"Purch. Rcpt. Line", OnInsertInvLineFromRcptLineOnBeforeCheckPurchLineReceiptNo, '', false, false)]
    local procedure OnInsertInvLineFromRcptLineOnBeforeCheckPurchLineReceiptNo(var IsHandled: Boolean)
        IsHandled := true;


Test video:

Very simple, give it a try!!!😁


Hope this will help.

Thanks for reading.



Copied title and URL