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

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about how to copy/flow Links and Notes from Sales order to Warehouse shipment in Business Central. Last week we briefly discussed how to copy/flow Links and Notes from Purchase order to Warehouse receipt. In this post I will briefly add some information about sales orders.
As you might know, 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 42 “Sales Order”:

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

When a location requires warehouse shipments, 

And when work is done on an order-by-order basis. Choose the Create Warehouse Shipment action in the source document to create a warehouse shipment for the document, such as Sales Order.

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 OnAfterCreateWhseShipmentHeaderFromWhseRequest event.

Source Code:

codeunit 50200 EventHandler
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Get Source Doc. Outbound", OnAfterCreateWhseShipmentHeaderFromWhseRequest, '', false, false)]
    local procedure Outbound_OnAfterCreateWhseShipmentHeaderFromWhseRequest(var WarehouseRequest: Record "Warehouse Request"; var WhseShptHeader: Record "Warehouse Shipment Header")
    var
        RecordLinkMgt: Codeunit "Record Link Management";
        SourceSalesHeader: Record "Sales Header";
    begin
        if SourceSalesHeader.Get(SourceSalesHeader."Document Type"::Order, WarehouseRequest."Source No.") then
            RecordLinkMgt.CopyLinks(SourceSalesHeader, WhseShptHeader);
    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

6. Dynamics 365 Business Central: How to copy attachments from Warehouse Receipt to Posted Warehouse Receipt – Customization

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL