Dynamics 365 Business Central: How to copy/flow Links and Notes from Purchase order to Warehouse receipt

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about how to copy/flow Links and Notes from Purchase order to Warehouse receipt in Business Central. This is a question I saw in the Dynamics 365 Community yesterday, more details: How to flow Purchase order ->Notes to warehouse receipt ->Notes in the factbox in business central
First let’s look at where the problem is. On most list pages, cards, and documents, you can attach files, add links, and write notes on the Attachments tab of the FactBox pane.
System Parts:

ValueDescription
LinksAllows the user to add links to a URL or path on the record shown in the page. For example, on an Item card, a user can add a link to the supplier’s item catalog. The links will appear with the record when it is viewed. When a user chooses a link, the target file opens.
NotesAllows the user to write a note on the record shown in the page. For example, when creating a sales order, a user can add a note about the order. The note will appear with the item when it is viewed.

For example, page 50 “Purchase Order”:

PS: If it is not displayed by default, you can use the Personalization feature to display it.

When items arrive at a warehouse that is set up to process warehouse receipts,

And when work is done on an order-by-order basis. Choose the Create Whse. Receipt action in the source document, such as Purchase Order, Sales Return Order, or Transfer Order to create warehouse receipt for one source document.

But there is a small problem, Links and Notes are not copied automatically.

Yes, this requires customization. But it’s not very difficult.
This time we can use the OnAfterCreateWhseReceiptHeaderFromWhseRequest event.

Source Code:

codeunit 50200 EventHandler
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Get Source Doc. Inbound", OnAfterCreateWhseReceiptHeaderFromWhseRequest, '', false, false)]
    local procedure OnAfterCreateWhseReceiptHeaderFromWhseRequest(var WhseReceiptHeader: Record "Warehouse Receipt Header"; var WarehouseRequest: Record "Warehouse Request")
    var
        RecordLinkMgt: Codeunit "Record Link Management";
        SourcePurchaseHeader: Record "Purchase Header";
    begin
        if SourcePurchaseHeader.Get(SourcePurchaseHeader."Document Type"::Order, WarehouseRequest."Source No.") then
            RecordLinkMgt.CopyLinks(SourcePurchaseHeader, WhseReceiptHeader);
    end;
}

Test video:

Very simple, give it a try!!!😁

PS:
1. Dynamics 365 Business Central: How to import Links and Notes (System Parts) – Customization

2. Dynamics 365 Business Central: How to export Links and Notes (System Parts) – Customization

3. Dynamics 365 Business Central: How to copy Links and Notes (System Parts) – Customization

4. Dynamics 365 Business Central: How to copy Links and Notes to Posted Documents (such as from Sales Order to Posted Sales Invoice) – No customization

5. Dynamics 365 Business Central: How to flow/pass custom field values

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL