Item Tracking in Sales Order


In Dynamics Business Central, I am trying to open the “Item tracking Lines” page through DrillDown trigger and transfer the “Lot No” value into the LotNo field that I have created in “sales Line” table and corresponding Pages/Forms.

To Open The Page I am trying The Following Code but it is not working…

trigger OnDrillDown()
ItemTrack: Record “Tracking Specification”;

Page.Run(Page::“Item Tracking Lines”, ItemTrack);


That page uses “Tracking Specification” as a temp table. You need to load that table first. See the function “OpenItemTrackingLines” on “Sales Line” (table 37) for an example. This is the function called when you click the “Item Tracking” action on the page. It calls a codeunit function. Which loads the temp table and runs the page. You’ll need to adapt to your needs, but that should give you a guide.

1 Like

Thanks for your quick reply,

By clicking on the LotNo field in “Sales order Subform” to load the “Item tracking Lines” I am getting the following Error

Error: Code must have a value in Item Tracking Code: Code=. It cannot be zero or empty. Page Edit - Item Tracking Lines has to close.

I Have already define the Lot No Code for that item in “Item tracking Codes” form.

Set the Item Tracking to Lot No. for that item.

Thanks, issue resolved.

Could you post how you solved the problem? Other users may have the same question in the future. Having solutions on threads increases the value of this forum.

After setting Item Tracking to Lot No for an item, I have written the following code in DrillDown Trigger for ‘Lot No’ field.

field(“Lot No”; Rec.“Lot No”)

            ToolTip = 'Lot No';
            Caption = 'Lot No';
            ApplicationArea = All;
            Enabled = false;
            trigger OnDrillDown()
                ReservationRec: Record "Reservation Entry";
                ReserveEntryCU: Codeunit "Sales Line-Reserve";
                ReserveEntryCU.CallItemTracking(Rec); //Call Procedure From Codeunit 99000832 to open Item Tracking Lines Page
                ReservationRec.SetRange("Source ID", Rec."Document No.");
                ReservationRec.SetRange("Item No.", Rec."No.");
                ReservationRec.SetRange("Location Code", Rec."Location Code");
                ReservationRec.SetRange("Source Ref. No.", Rec."Line No.");
                if ReservationRec.FindFirst() then begin
                    Rec.TestField(Type, Rec.Type::Item);
                    Rec."Lot No" := ReservationRec."Lot No.";

What if the sales line has multiple lots assigned?