ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] - CheckDirectPosting table 221 "Gen. Jnl. Allocation"

Open Wiechardt opened this issue 3 years ago • 1 comments

Dear ALAppExtensions Team,

Please consider adding a new method and new event publishers in table 221 "Gen. Jnl. Allocation" to check the Direct Posting on a G/L Account to allow me to bypass this check the same way this is allowed in the Gen. Journal Line table with the OnBeforeCheckDirectPosting(GLAccount, IsHandled, Rec) event.

NEW PUBLISHERS:

[IntegrationEvent(false, false)] local procedure OnBeforeCheckDirectPosting(GLAccount, IsHandled, Rec); begin end;

[IntegrationEvent(false, false)] local procedure OnAfterCheckDirectPosting(var GLAccount: Record "G/L Account"; GenJournalLine: Record "Gen. Journal Line") begin end;

The code in Table 221, Field 5 to be modified as follows:

OLD CODE:

field(5; "Account No."; Code[20])
    {
        Caption = 'Account No.';
        TableRelation = "G/L Account";

        trigger OnValidate()
        begin
            if "Account No." = '' then begin
                GLAcc.Init();
                CreateDimFromDefaultDim();
            end else begin
                GLAcc.Get("Account No.");
                GLAcc.CheckGLAcc();
                **GLAcc.TestField("Direct Posting", true);**
            end;

. .

NEW CODE:

field(5; "Account No."; Code[20])
    {
        Caption = 'Account No.';
        TableRelation = "G/L Account";

        trigger OnValidate()
        begin
            if "Account No." = '' then begin
                GLAcc.Init();
                CreateDimFromDefaultDim();
            end else begin
                GLAcc.Get("Account No.");
                GLAcc.CheckGLAcc();
                **CheckDirectPosting(GLAcc)**
            end;

local procedure CheckDirectPosting(var GLAccount: Record "G/L Account")
var
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeCheckDirectPosting(GLAccount, IsHandled, Rec);
    if IsHandled then
        exit;

    GLAccount.TestField("Direct Posting", true);

    OnAfterCheckDirectPosting(GLAccount, Rec);
end;

Thanks in advance!

Wiechardt avatar May 17 '23 07:05 Wiechardt

Availability update: We will publish a fix for this issue in the next update for release 22.

Build ID to track: 56846.

JesperSchulz avatar May 22 '23 07:05 JesperSchulz