Skip to main content

Notifications

Announcements

No record found.

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 75,802 Super User 2024 Season 2 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 13,011 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,703 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans