web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Update Item Tracking in Sales Lines & Whse. Shipment Lines

(0) ShareShare
ReportReport
Posted on by 291
Hello, 
           I have to update the Item Tracking lines in Sales Lines (order) and Whse. Shipment Lines(created from that) , but these both should be updated when the Item Tracking Lines of Assembly Order Lines are updated ( also when updating lines of the Assembly Order Header's Item Tracking should be updated with same data- which is getting updated via below given Event Subscriber Code ). So suggest me code for updating the Sales Line (order) and Whse. Shipment Lines. Either by event subscriber or by any action in Line or Header Item Tracking of Assembly Order - so that same data passes to the Sales Lines and Whse. Shipment Lines.
 
[EventSubscriber(ObjectType::Table, Database::"Reservation Entry", OnAfterCopyTrackingFromTrackingSpec, '', true, true)]
 local procedure OnAfterCopyTrackingFromTrackingSpec(var ReservationEntry: Record "Reservation Entry"; TrackingSpecification: Record "Tracking Specification")
 var
 TrackSpecs: Record "Tracking Specification";
 LastEntryNo: Integer;
 AssemblyHeader: Record "Assembly Header";
 ReservEntry: Record "Reservation Entry";
 LastReservEntryNo: Integer;
 l: page "Item Tracking Lines";
 begin
 if TrackingSpecification."Source Type" <> Database::"Assembly Line" then
 exit;
 if TrackingSpecification."Serial No." = '' then
 exit;
 // Find Assembly Header
 AssemblyHeader.Reset();
 AssemblyHeader.SetRange("Document Type", TrackingSpecification."Source Subtype");
 AssemblyHeader.SetRange("No.", TrackingSpecification."Source ID");
 if not AssemblyHeader.FindFirst() then
 exit;
 
 ReservEntry.Reset();
 if ReservEntry.FindLast() then
 LastReservEntryNo := ReservEntry."Entry No."
 else
 LastReservEntryNo := 0;
 
 ReservEntry.Init();
 ReservEntry."Entry No." := LastReservEntryNo + 1;
 ReservEntry.Positive := true;
 ReservEntry.Validate("Item No.", AssemblyHeader."Item No.");
 ReservEntry.Validate("Location Code", AssemblyHeader."Location Code");
 ReservEntry.Validate("Quantity", TrackingSpecification."Quantity (Base)");
 ReservEntry.Validate("Quantity (Base)", TrackingSpecification."Quantity (Base)");
 ReservEntry.Validate("Qty. to Handle (Base)", TrackingSpecification."Qty. to Handle (Base)");
 ReservEntry.Validate("Qty. to Invoice (Base)", TrackingSpecification."Qty. to Invoice (Base)");
 ReservEntry."Qty. per Unit of Measure" := TrackingSpecification."Qty. per Unit of Measure";
 ReservEntry."Reservation Status" := ReservEntry."Reservation Status"::Surplus;
 ReservEntry."Source Type" := Database::"Assembly Header";
 ReservEntry."Source Subtype" := TrackingSpecification."Source Subtype";
 ReservEntry."Source ID" := TrackingSpecification."Source ID";
 ReservEntry."Source Ref. No." := 0;
 ReservEntry.Validate("Serial No.", TrackingSpecification."Serial No.");
 ReservEntry.Validate("Lot No.", TrackingSpecification."Lot No.");
 ReservEntry."Creation Date" := Today;
 ReservEntry.Insert(true);
 end;
 
 
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,872 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,110 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 892

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans