Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

custom field from WH Shipment to posted sales shipment

(1) ShareShare
ReportReport
Posted on by 98
Howto transfer custom (pnumber) field from WH Shipment header to posted sales shipment/Sales Shipment Header  on posting Wh shipment. 
Fields are in both tables already.
 
Now I have but is is not copying field.
 
[EventSubscriber(ObjectType::Codeunit, Codeunit::/Whse.-Post Shipment/, 'OnInitSourceDocumentHeaderOnBeforeSalesHeaderModify', '', false, false)]
    local procedure CopyProNumberToSalesShipment(var SalesHeader: Record /Sales Header/; WarehouseShipmentHeader: Record /Warehouse Shipment Header/)
    var
        WarehouseShipmentHeaderExt: Record /Warehouse Shipment Header/ temporary;
        SalesShipmentHeaderExt: Record /Sales Shipment Header/ temporary;
    begin
        WarehouseShipmentHeaderExt.SetRange(/No./, WarehouseShipmentHeader./No./);
        if WarehouseShipmentHeaderExt.FindFirst() then begin
            SalesShipmentHeaderExt.SetRange(/No./, SalesHeader./No./);
            if SalesShipmentHeaderExt.FindFirst() then begin
                SalesShipmentHeaderExt./PNumber/ := WarehouseShipmentHeaderExt./PNumber/;
                SalesShipmentHeaderExt.Modify();
            end;
        end;
    end;
 
 
  • Hans Werps Profile Picture
    Hans Werps 98 on at
    custom field from WH Shipment to posted sales shipment
    Thx working
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 78,034 Super User 2025 Season 1 on at
    custom field from WH Shipment to posted sales shipment
    Just add a simple test: https://yzhums.com/4118/#toc10
     
    Hope this helps as well.
    Thanks.
    ZHU
  • Suggested answer
    Ariba Mehdi Profile Picture
    Ariba Mehdi 160 on at
    custom field from WH Shipment to posted sales shipment
    Hi there,

    Verify if you have assigned the same field ID in both tables. If not, assign matching field IDs to both fields and check again. 
     
    Hope it helps!
     
  • Suggested answer
    gdrenteria Profile Picture
    gdrenteria 14,573 Most Valuable Professional on at
    custom field from WH Shipment to posted sales shipment
    Hi
    I would think about this place. I hope it will help you.
    Best regards
    Gerardo

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans