Hi All,
I subscribe to the Event in "Purch.-Post" codeunit ie "OnBeforePostInvoicePostBuffer" and calculate the sum from "TempInvoicePostBuffer" as below code
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", 'OnBeforePostInvoicePostBuffer', '', true, true)]
local procedure CalSumInvTotal(PurchaseHeader: Record "Purchase Header"; var TempInvoicePostBuffer: Record "Invoice Post. Buffer"; var TotalPurchLine: Record "Purchase Line"; var TotalPurchLineLCY: Record "Purchase Line")
begin
TempInvoicePostBuffer.CalcSums(Amount);
TotalInvAmount := TempInvoicePostBuffer.Amount;
end;
I found the value in "TotalInvAmount". but the issue is that I want to compare this variable ["TotalInvAmount" in another event subscriber but there is value is shown as "Zero". as below code.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", 'OnBeforePostVendorEntry', '', true, true)]
local procedure PostWHTCal(var GenJnlLine: Record "Gen. Journal Line"; var PurchHeader: Record "Purchase Header"; var TotalPurchLine: Record "Purchase Line"; var TotalPurchLineLCY: Record "Purchase Line"; PreviewMode: Boolean; CommitIsSupressed: Boolean; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line")
begin
Message('%1', TotalInvAmount);
end;
Any suggestions How can get the variable value into another event subscriber? Thaks is Advanced