Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Custom field from Warehouse Receipt Line (7317) to Posted Whse. Receipt Line (7319)

Posted on by 53
Hi Guys,

Can you please assist, I have a custom field APTRRC_TempValQty on Warehouse Receipt Line table and want this value to be displayed in the same custom field in the Posted Whse. Receipt Line table after I post the warehouse receipt. I have already created the fields in both tables but do not know what EventSubscriber to use or if I am doing it correctly.

I have tried the following 3 EventSubscribers but my field value is not pulling through to the Posted Warehouse Receipt Lines:
 
   [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnBeforePostedWhseRcptLineInsert', '', false, false)]
    local procedure OnBeforePostWhseReceiptLine(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
    begin
        PostedWhseReceiptLine.APTRRC_TempValQty := WarehouseReceiptLine.APTRRC_TempValQty;
    end;
 
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnBeforePostWhseJnlLine', '', false, false)]
    local procedure OnBeforePostWhseJnlLine(var PostedWhseReceiptHeader: Record "Posted Whse. Receipt Header"; var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; var WhseReceiptLine: Record "Warehouse Receipt Line"; var TempTrackingSpecification: Record "Tracking Specification" temporary; var IsHandled: Boolean)
    begin
        PostedWhseReceiptLine.APTRRC_TempValQty := WhseReceiptLine.APTRRC_TempValQty;
    end;
 
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', false, false)]
    local procedure OnBeforePostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
    begin
        PostedWhseReceiptLine.APTRRC_TempValQty := WarehouseReceiptLine.APTRRC_TempValQty;
    end;
 
What am i doing wrong?
 
Thanks
Divan
 
 
 
  • Divan Profile Picture
    Divan 53 on at
    Custom field from Warehouse Receipt Line (7317) to Posted Whse. Receipt Line (7319)
    So for some reason the Even Subscriber did not work to get the values in the Posted Whse. Receipt Line (7319). I ended up creating a new table
    to store the values I want with the OnAfterCheckWhseRcptLine, I assume this is because this page gets deleted and the value disappears
    somewhere in between. (This value is a FlowField).

    This worked for me:

        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterCheckWhseRcptLine', '', false, false)]
        local procedure OnAfterCheckWhseRcptLine(var WarehouseReceiptLine: Record "Warehouse Receipt Line")
        var
            WhseRcptValQty: Record APTRRC_WhseReceiptValQty;
        begin
            if WhseRcptValQty.Get(WarehouseReceiptLine."No.",WarehouseReceiptLine."Source No.", WarehouseReceiptLine."Line No.") then
        begin
                WhseRcptValQty.APTRRC_TempValQty := WarehouseReceiptLine.APTRRC_TempValQty;
                WhseRcptValQty.Modify();
            end else begin
                WhseRcptValQty.Init();
                WhseRcptValQty.APTRRC_No := WarehouseReceiptLine."No.";
                WhseRcptValQty.APTRRC_SourceNo := WarehouseReceiptLine."Source No.";
                WhseRcptValQty.APTRRC_LineNo := WarehouseReceiptLine."Line No.";
                WhseRcptValQty.APTRRC_TempValQty := WarehouseReceiptLine.APTRRC_TempValQty;
                WhseRcptValQty.Insert();
            end;
        end;

    And from this table I made a new flowfield to the Posted Whse Receipt table and the values is now visible.
  • Custom field from Warehouse Receipt Line (7317) to Posted Whse. Receipt Line (7319)
    .
  • Divan Profile Picture
    Divan 53 on at
    Custom field from Warehouse Receipt Line (7317) to Posted Whse. Receipt Line (7319)
    Hi gdrenteria,

    I have a similar event than the one in the link you have provided but my data is still not pulling through to the posted warehouse receipt, the one I have used that is similar is
     
       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnBeforePostedWhseRcptLineInsert', '', false, false)]
        local procedure OnBeforePostWhseReceiptLine(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
        begin
            PostedWhseReceiptLine.APTRRC_TempValQty := WarehouseReceiptLine.APTRRC_TempValQty;
        end;
  • gdrenteria Profile Picture
    gdrenteria 5,292 Super User on at
    Custom field from Warehouse Receipt Line (7317) to Posted Whse. Receipt Line (7319)

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans