ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[W1][Table][1294][Applied Payment Entry] OnBeforeSuggestAmtToApply event

Open polina-se opened this issue 1 year ago • 1 comments

Why do you need this change?

Dear Microsoft Team, I would like to request a new event, OnBeforeSuggestAmtToApply, in table 1294 'Applied Payment Entry'. This event will allow us to calculate the RemAmtToApply based on the custom Account Type values.

Describe the request

The OnBeforeSuggestAmtToApply event in table 1294 'Applied Payment Entry' is needed to calculate the RemAmtToApply based on custom Account Type values and bypass standard logic. This change is needed in BC25.

Proposed Event Code:

[W1][Table][1294][Applied Payment Entry]
trigger OnBeforeSuggestAmtToApply()
___
This event is needed to calculate the RemAmtToApply based on custom Account Type values.
___
[IntegrationEvent(false, false)]
local procedure OnBeforeSuggestAmtToApply(var Rec: Record "Applied Payment Entry"; var Result: Decimal; var IsHandled: Boolean)
begin
end;

Proposed Procedure Code:

procedure SuggestAmtToApply(): Decimal
var
    RemAmtToApply: Decimal;
    LineRemAmtToApply: Decimal;
    Result: Decimal;
    IsHandled: Boolean;
begin
    // new begin
    IsHandled := false;
    OnBeforeSuggestAmtToApply(Rec, Result, IsHandled);
    if IsHandled then
        exit(Result);
    // new end

    RemAmtToApply := GetRemAmt() - GetAmtAppliedToOtherStmtLines();
    LineRemAmtToApply := GetStmtLineRemAmtToApply() + "Applied Pmt. Discount";

    if "Account Type" = "Account Type"::Customer then
        if (LineRemAmtToApply >= 0) and ("Document Type" = "Document Type"::"Credit Memo") then
            exit(RemAmtToApply);
    if "Account Type" = "Account Type"::Vendor then
        if (LineRemAmtToApply <= 0) and ("Document Type" = "Document Type"::"Credit Memo") then
            exit(RemAmtToApply);

    exit(
      AbsMin(
        RemAmtToApply,
        LineRemAmtToApply));
end;

Internal work item: AB#597432

polina-se avatar Aug 13 '25 13:08 polina-se

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.

Build ID: 38339.

JesperSchulz avatar Aug 21 '25 09:08 JesperSchulz