microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
773 stars 610 forks source link

[Event Request] Table 39 "Purchase Line" OnAfterClearQtyIfBlank #26711

Closed ZepposBE closed 2 months ago

ZepposBE commented 3 months ago

Describe the request

Hello development team,

We would like to see a new event added to the Purchase Line table in the ClearQtyIfBlank procedure:

procedure ClearQtyIfBlank()
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeClearQtyIfBlank(Rec, IsHandled);
        if IsHandled then
            exit;

        if "Document Type" = "Document Type"::Order then begin
            GetPurchSetup();
            if PurchSetup."Default Qty. to Receive" = PurchSetup."Default Qty. to Receive"::Blank then begin
                "Qty. to Receive" := 0;
                "Qty. to Receive (Base)" := 0;
            end;
        end;
        >>>>>>>>> New Event
        OnAfterClearQtyIfBlank(Rec, xRec, PurchSetup);
        <<<<<<<<< New Event
    end;

With the event and parameters like this:

 [IntegrationEvent(false, false)]
    local procedure OnAfterClearQtyIfBlank(var PurchaseLine: Record "Purchase Line"; xPurchaseLine: Record "Purchase Line"; PurchasePayablesSetup: Record "Purchases & Payables Setup";)
    begin
    end;

Thank you.

Additional context

We have a link between different types of lines and we need to keep some information in sync between these lines. Since the ClearQtyIfBlank procedure is public, it can be called regardless of a field validation for which we already have code to sync afterwards. We want to catch this missing scenario also. Internal work item: AB#539244

JesperSchulz commented 2 months ago

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: 21460.