ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 38 "Purchase Header", field 53 "Applies-to Doc. No.", OnValidate trigger; OnBeforeValidateAppliesToDocNo

Open nd2403 opened this issue 5 years ago • 1 comments

Hello, we need additional validation in field 53 of Purchase Header table, thank you in advance.

field(53; "Applies-to Doc. No."; Code[20])
        {
            trigger OnValidate()
            var
                // - 22.11.21 NDA ND#0303347
                // moved to the subscriber OnValidateDocumetType in oodeunit "Purchase Header MGB"
                // VendDepLedgEntryL: Record "Vend. Deposit Ledger Entry";
                // + 22.11.21 NDA ND#0303347
                IsHandeld: Boolean;
            begin
                if "Applies-to Doc. No." <> '' then
                    TestField("Bal. Account No.", '');
// - new
                IsHandeld := false;
                OnBeforeValidateAppliesToDocNo(Rec, IsHandeld);
                if IsHandeld then
                    exit;
// + new
                if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and (xRec."Applies-to Doc. No." <> '') and
                      ("Applies-to Doc. No." <> '')
                then begin
                    SetAmountToApply("Applies-to Doc. No.", "Buy-from Vendor No.");
                    SetAmountToApply(xRec."Applies-to Doc. No.", "Buy-from Vendor No.");
                end else
                    if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and (xRec."Applies-to Doc. No." = '') then
                        SetAmountToApply("Applies-to Doc. No.", "Buy-from Vendor No.")
                    else
                        if ("Applies-to Doc. No." <> xRec."Applies-to Doc. No.") and ("Applies-to Doc. No." = '') then
                            SetAmountToApply(xRec."Applies-to Doc. No.", "Buy-from Vendor No.");
            end;
        }
    [IntegrationEvent(false, false)]
    local procedure OnBeforeValidateAppliesToDocNo(var PurchHeader: Record "Purchase Header"; var IsHandeld: Boolean)
    begin
    end;

nd2403 avatar Nov 23 '21 14:11 nd2403

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.

JesperSchulz avatar Nov 30 '21 13:11 JesperSchulz