Hi All
I'm trying to copy sales order (original) quantity to posted Invoice line user field. This is to calculate back order quantity and show on posted invoice. The event below did not work:
Hi, try the follwoing.
tableextension 80122 MyExtension extends "Sales Invoice Line" { fields { field(50100; OrigianlQuantity; Decimal) { DataClassification = CustomerContent; } } } pageextension 80122 MyExtension extends "Posted Sales Invoice Subform" { layout { addafter(Quantity) { field(OrigianlQuantity; Rec.OrigianlQuantity) { ApplicationArea = All; } } } } codeunit 80122 MyCodeunit { Permissions = tabledata "Sales Invoice Line" = rimd; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnAfterPostSalesLine', '', false, false)] local procedure OnAfterPostSalesLine(var SalesLine: Record "Sales Line"; var SalesInvLine: Record "Sales Invoice Line"); begin SalesInvLine.OrigianlQuantity := SalesLine.Quantity; SalesInvLine.Modify(); end; }
Hope this will help.
Thanks.
ZHU
I would recommend you to try the "OnBeforeSalesInvLineInsert" event in the same codeunit.
Butif there is a back order quantity on the line the sales line should anyway not be deleted?
Only sales lines that are fully invoiced will be deleted during post.
Sohail Ahmed
2,655
Mansi Soni
1,574
YUN ZHU
1,453
Super User 2025 Season 1