Event Request in Codeunit 12 - in function PostDtldCVLedgEntry
new integration event: LOCAL [IntegrationEvent] OnBeforeCreateGLEntryGainLoss(DtldCVLedgEntryBuf : Record "Detailed CV Ledg. Entry Buffer";VAR GenJnlLine : Record "Gen. Journal Line";VAR Unapply : Boolean)
============ LOCAL PostDtldCVLedgEntry(GenJnlLine : Record "Gen. Journal Line";DtldCVLedgEntryBuf : Record "Detailed CV Ledg. Entry Buffer";AccNo : Code[20];VAR AdjAmount : ARRAY [4] OF Decimal;Unapply : Boolean) WITH DtldCVLedgEntryBuf DO CASE "Entry Type" OF "Entry Type"::"Initial Entry": ; "Entry Type"::Application: ; "Entry Type"::"Unrealized Loss", "Entry Type"::"Unrealized Gain", "Entry Type"::"Realized Loss", "Entry Type"::"Realized Gain": BEGIN // New code begin OnBeforeCreateGLEntryGainLoss(DtldCVLedgEntryBuf,GenJnlLine,Unapply); // New code end CreateGLEntryGainLoss(GenJnlLine,AccNo,-"Amount (LCY)","Currency Code" = AddCurrencyCode); IF NOT Unapply THEN CollectAdjustment(AdjAmount,-"Amount (LCY)",0);