web
You’re offline. This is a read only version of the page.
close
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...
Suggested Answer

Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

(0) ShareShare
ReportReport
Posted on by 238
Hi Experts 
I need to flow field from "Warehouse Receipt Line" to Purch. Recpt Line"  but not able to find any event subsciber in Codeunit::"Whse.-Post Receipt" can any one help me to flow using event subsciber or any other way any help Really appriciated 
i have added other sample code bellow event sub code which moving data from  "Warehouse Receipt Line" to "Posted Whse. Receipt Line" 
in my our we need to move data from   "Warehouse Receipt Line" to Purch. Recpt line
sample code 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', true, true)]
    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
    var

    begin
        PostedWhseReceiptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";
        PostedWhseReceiptLine.Remarks := WarehouseReceiptLine.Remarks;
        PostedWhseReceiptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";
        PostedWhseReceiptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";
        PostedWhseReceiptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

    end;
   
I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    You can use same subscriber and get the Purch. Recpt Header and Lines and update

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', false, false)]

       local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line");

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptHeader.Get(PostedWhseReceiptLine."Posted Source No.");

               //get Lines and your logic

           end;

       end;

  • DineshM Profile Picture
    238 on at

    Hi sir

    Thank you for your Response 

    I have modified code as follow but How it will update Purch Recpt line as no Record variable taken as purch. Recpt line 

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', true, true)]

       local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptHeader.Get(PostedWhseReceiptLine."Posted Source No.");

               PostedWhseReceiptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";

               PostedWhseReceiptLine.Remarks := WarehouseReceiptLine.Remarks;

               PostedWhseReceiptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";

               PostedWhseReceiptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";

               PostedWhseReceiptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

           end;

       end;

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    You have to get the receipt lines from receipt header and use in code.

    //get Lines and your logic

  • DineshM Profile Picture
    238 on at

    Hi sir ,

    I have added following Code but it will give error as follows while post Receipt action

    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

           PurchaseRecptLine: Record "Purch. Rcpt. line";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptLine.Get(PostedWhseReceiptLine."Posted Source No.");

               PurchaseRecptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";

               PurchaseRecptLine.Remarks := WarehouseReceiptLine.Remarks;

               PurchaseRecptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";

               PurchaseRecptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";

               PurchaseRecptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

           end;

       end;

    pastedimage1677148170317v1.png

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    Primary key of PurchaseRecptLine is Document No. and Line No.

    You may have multiple Lines in PurchaseRecptLine.

    Do you want to update all lines?

  • DineshM Profile Picture
    238 on at

    yes sir

    need to update if there  single lines then single lines updation and if mutiple lines then multiple lines update from warehouse Recpt line to purch Receipt Line.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    You have to write something like

    PurchaseRecptLine.SetRange("Document No.", PurchaseRecptHeader."No.");

               if PurchaseRecptLine.FindSet() then

                   repeat

                       PurchaseRecptLine."Custom field" := WarehouseReceiptLine."Custom field";

                       PurchaseRecptLine.Modify();

                   until PurchaseRecptLine.Next() = 0;

  • Suggested answer
    Amit Profile Picture
    2,559 on at

    Hi,

    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
        var
            PurchaseRecptHeader: Record "Purch. Rcpt. Header";
            PurchaseRecptLine: Record "Purch. Rcpt. line";
        begin
            if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin
                PurchaseRecptLine.reset;
                PurchaseRecptLine.setrange("Document No.",PostedWhseReceiptLine."Posted Source No.");
                if PurchaseRecptLine.FindSet() then begin
                    Repeat
                        PurchaseRecptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";
                        PurchaseRecptLine.Remarks := WarehouseReceiptLine.Remarks;
                        PurchaseRecptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";
                        PurchaseRecptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";
                        PurchaseRecptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";
                        PurchaseRecptLine.Modify
                    until PurchaseRecptLine.next =0;
                end;
            end;

        end;
    Regards
    Amit Sharma
    linkedin.com/in/amit-sharma-94542440/
    Pls press yes if info is useful.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,066

#2
YUN ZHU Profile Picture

YUN ZHU 658 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 595

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans