[Event Change] Codeunit 12 "Gen. Jnl.-Post Line", OnBeforeDeferralPosting
Please change the AccountNo parameter to 'var' so that we can update the value from the event, without having to set IsHandled to true and duplicate code.
Current definition:
[IntegrationEvent(false, false)]
local procedure OnBeforeDeferralPosting(DeferralCode: Code[10]; SourceCode: Code[10]; AccountNo: Code[20]; var GenJournalLine: Record "Gen. Journal Line"; Balancing: Boolean; var IsHandled: Boolean)
begin
end;
Requested definition:
[IntegrationEvent(false, false)]
local procedure OnBeforeDeferralPosting(DeferralCode: Code[10]; SourceCode: Code[10]; var AccountNo: Code[20]; var GenJournalLine: Record "Gen. Journal Line"; Balancing: Boolean; var IsHandled: Boolean)
begin
end;
Reference: https://github.com/microsoft/ALAppExtensions/issues/11254 Reference: https://github.com/microsoft/ALAppExtensions/issues/16062
Example subscriber:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnBeforeDeferralPosting', '', false, false)]
local procedure OnBeforeDeferralPosting(DeferralCode: Code[10]; SourceCode: Code[10]; AccountNo: Code[20]; var GenJournalLine: Record "Gen. Journal Line"; Balancing: Boolean; var IsHandled: Boolean);
var
rlVATPostingSetup: Record "VAT Posting Setup";
begin
if DeferralCode <> '' then begin
if not Balancing then begin
IF GenJournalLine."VAT Calculation Type" = GenJournalLine."VAT Calculation Type"::"Full VAT" THEN BEGIN
rlVATPostingSetup.GET(GenJournalLine."VAT Bus. Posting Group", GenJournalLine."VAT Prod. Posting Group");
rlVATPostingSetup.TESTFIELD(rlVATPostingSetup.XXX_ProrateFullVATPurchAcc);
AccountNo := rlVATPostingSetup.XXX_ProrateFullVATPurchAcc;
//PostDeferral(GenJournalLine, AccountNo); //Impossible from eventsubscriber
//IsHandled := true;
END;
end;
end;
end;
We are currently with an OnPrem-Italy-18.5 Instance Thanks
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.