You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add the TempSalesOrderHeader parameter to the OnAfterPostUpdateInvoiceLine event:
local procedure PostUpdateInvoiceLine(var SalesHeader: Record "Sales Header")
var
SalesOrderLine: Record "Sales Line";
SalesShptLine: Record "Sales Shipment Line";
TempSalesLine: Record "Sales Line" temporary;
TempSalesOrderHeader: Record "Sales Header" temporary;
CRMSalesDocumentPostingMgt: Codeunit "CRM Sales Document Posting Mgt";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforePostUpdateInvoiceLine(TempSalesLineGlobal, IsHandled);
if IsHandled then
exit;
ResetTempLines(TempSalesLine);
TempSalesLine.SetFilter("Shipment No.", '<>%1', '');
TempSalesLine.SetFilter(Type, '<>%1', TempSalesLine.Type::" ");
if TempSalesLine.FindSet() then
repeat
SalesShptLine.Get(TempSalesLine."Shipment No.", TempSalesLine."Shipment Line No.");
SalesOrderLine.Get(
SalesOrderLine."Document Type"::Order,
SalesShptLine."Order No.", SalesShptLine."Order Line No.");
OnPostUpdateInvoiceLineOnAfterGetSalesOrderLine(TempSalesLine, SalesShptLine, SalesOrderLine);
if TempSalesLine.Type = TempSalesLine.Type::"Charge (Item)" then
UpdateSalesOrderChargeAssgnt(TempSalesLine, SalesOrderLine);
IsHandled := false;
OnPostUpdateInvoiceLineOnBeforeCalcQuantityInvoiced(SalesOrderLine, TempSalesLine, IsHandled);
if not IsHandled then begin
SalesOrderLine."Quantity Invoiced" += TempSalesLine."Qty. to Invoice";
SalesOrderLine."Qty. Invoiced (Base)" += TempSalesLine."Qty. to Invoice (Base)";
end;
CheckSalesLineInvoiceMoreThanShipped(SalesOrderLine, TempSalesLine, SalesShptLine);
OnPostUpdateInvoiceLineOnBeforeInitQtyToInvoice(SalesOrderLine, TempSalesLine);
SalesOrderLine.InitQtyToInvoice();
if SalesOrderLine."Prepayment %" <> 0 then begin
SalesOrderLine."Prepmt Amt Deducted" += TempSalesLine."Prepmt Amt to Deduct";
SalesOrderLine."Prepmt VAT Diff. Deducted" += TempSalesLine."Prepmt VAT Diff. to Deduct";
DecrementPrepmtAmtInvLCY(
SalesHeader, TempSalesLine, SalesOrderLine."Prepmt. Amount Inv. (LCY)", SalesOrderLine."Prepmt. VAT Amount Inv. (LCY)");
SalesOrderLine."Prepmt Amt to Deduct" :=
SalesOrderLine."Prepmt. Amt. Inv." - SalesOrderLine."Prepmt Amt Deducted";
SalesOrderLine."Prepmt VAT Diff. to Deduct" := 0;
end;
IsHandled := false;
OnPostUpdateInvoiceLineOnBeforeInitOutstanding(SalesOrderLine, IsHandled);
if not IsHandled then
SalesOrderLine.InitOutstanding();
OnPostUpdateInvoiceLineOnBeforeModifySalesOrderLine(SalesOrderLine, TempSalesLine);
SalesOrderLine.Modify();
OnPostUpdateInvoiceLineOnAfterModifySalesOrderLine(SalesOrderLine, TempSalesLine);
if not TempSalesOrderHeader.Get(SalesOrderLine."Document Type", SalesOrderLine."Document No.") then begin
TempSalesOrderHeader."Document Type" := SalesOrderLine."Document Type";
TempSalesOrderHeader."No." := SalesOrderLine."Document No.";
TempSalesOrderHeader.Insert();
end;
OnPostUpdateInvoiceLineOnAfterInsertSalesOrderHeader(SalesOrderLine, TempSalesLine);
until TempSalesLine.Next() = 0;
CRMSalesDocumentPostingMgt.CheckShippedOrders(TempSalesOrderHeader);
- OnAfterPostUpdateInvoiceLine(TempSalesLine, SalesHeader);+ OnAfterPostUpdateInvoiceLine(TempSalesLine, SalesHeader, TempSalesOrderHeader);
end;
[IntegrationEvent(true, false)]
- local procedure OnAfterPostUpdateInvoiceLine(var TempSalesLine: Record "Sales Line" temporary; var SalesHeader: Record "Sales Header")+ local procedure OnAfterPostUpdateInvoiceLine(var TempSalesLine: Record "Sales Line" temporary; var SalesHeader: Record "Sales Header"; var TempSalesOrderHeader: Record "Sales Header" temporary)
begin
end;
Additional context
We need to update every sales order that was (partially) posted.
PS: This change would make it possible for Microsoft to replace the CheckShippedOrders call with an event instead of calling CRMSalesDocumentPostingMgt.CheckShippedOrders. (Maybe one step further to modularizing CRM integration?)
The text was updated successfully, but these errors were encountered:
dannoe
changed the title
[Additional parameter in event] PostUpdateInvoiceLine - OnAfterPostUpdateInvoiceLine - Codeunit Sales-Post
[Event Change Request] PostUpdateInvoiceLine - OnAfterPostUpdateInvoiceLine - Codeunit Sales-Post
Feb 20, 2025
Describe the request
Please add the TempSalesOrderHeader parameter to the OnAfterPostUpdateInvoiceLine event:
Additional context
We need to update every sales order that was (partially) posted.
PS: This change would make it possible for Microsoft to replace the
CheckShippedOrders
call with an event instead of calling CRMSalesDocumentPostingMgt.CheckShippedOrders. (Maybe one step further to modularizing CRM integration?)The text was updated successfully, but these errors were encountered: