Skip to content

[Event Request] Codeunit 11000007 "Check BTL91" - OnBeforeCheckFreelyTransferableMaximumAmount #30085

@KateDovgalova

Description

@KateDovgalova

Why do you need this change?

In 4PS Construct we need to be able to skip check on "Freely Transferable Maximum" in codeunit 11000007 "Check BTL91" - OnRun. BTL91 is a domestic interbank payment format, while the "Freely Transferable Maximum" check is a regulatory requirement that only applies to international/foreign transfers.

New event needs IsHandled parameter because subscriber must be able to completely replace block with check on "Freely Transferable Maximum" — including suppressing error messages and controlling whether execution. The Result variable allows the subscriber to signal pass/fail, and IsHandled tells the standard code to skip its own logic entirely.

It's not possible to make same customization in a different way: the only other event in this codeunit is OnAfterOnRun, which fires at the very end of OnRun — after the amount check and all its exit paths. A subscriber to OnAfterOnRun receives control too late: the Error Message may already be set and the procedure may have already exited early. No event existed that could intercept or replace the FreelyTransferableMaximum.Amount comparison before it runs.

This event fires once per Proposal Line record during BTL91 payment processing. The FreelyTransferableMaximum record is already fetched before the event, so there is no extra database read at the event boundary. For typical payment batches (tens to a few hundred lines), performance impact is negligible. There are no loops within the event itself and no deferred or async operations involved.

The event exposes two records:
FreelyTransferableMaximum: country/region and amount threshold — financial compliance configuration, not personal data.
ProposalLine (var): payment amount, SWIFT code, bank name/city, country, currency, nature of payment, description, and Registration No. DNB.
The ProposalLine data is sensitive financial/banking information. Exposure is necessary because a subscriber replacing the standard validation must be able to evaluate the same data the standard logic would use.

Several subscribers can overwrite IsHandled or Error Message. Mitigation requires subscribers to guard their logic with specific conditions before setting IsHandled := true, and to avoid unconditional takeovers.

Describe the request

Dear ALAppExtensions team,

On behalf of 4PS I would like to request integration event 'OnBeforeCheckFreelyTransferableMaximumAmount' to be added to trigger OnRun on codeunit 11000007 "Check BTL91":

codeunit 11000007 "Check BTL91"
{
    TableNo = "Proposal Line";

    trigger OnRun()
    var
        FreelyTransferableMaximum: Record "Freely Transferable Maximum";
        Result: Boolean; //new
        IsHandled: Boolean; //new
    begin
        FreelyTransferableMaximum.Get(Rec."Acc. Hold. Country/Region Code", Rec."Currency Code");

        IsHandled := false; //new
        Result := true; //new
        OnBeforeCheckFreelyTransferableMaximumAmount(FreelyTransferableMaximum, Rec, Result, IsHandled); //new
        if IsHandled then begin //new
            if not Result then //new
                exit; //new
        end else //new
            if Rec.Amount > FreelyTransferableMaximum.Amount then
                case Rec."Nature of the Payment" of
    [IntegrationEvent(false, false)]
    local procedure OnBeforeCheckFreelyTransferableMaximumAmount(FreelyTransferableMaximum: Record "Freely Transferable Maximum"; var ProposalLine: Record "Proposal Line"; var Result: Boolean; var IsHandled: Boolean)
    begin
        //new
    end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions