microsoft / ALAppExtensions

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

[Event Request] Table 38 "PurchaseHeader" - procedure PerformManualRelease #26986

Closed dorinbirsan closed 2 months ago

dorinbirsan commented 2 months ago

Describe the request

Describe the request

The current change would benefit the fact that we could handle the code from the procedure PerformManualRelease inside "Purchase Header" table.

Current:

    internal procedure PerformManualRelease()
    var
        ReleasePurchDoc: Codeunit "Release Purchase Document";
    begin
        if Rec.Status <> Rec.Status::Released then begin
            ReleasePurchDoc.PerformManualRelease(Rec);
            Commit();
        end;
    end;

Requested:

    ...

    internal procedure PerformManualRelease()
    var
        ReleasePurchDoc: Codeunit "Release Purchase Document";
        IsHandled: Boolean;
    begin
        OnBeforePerformManualRelease(Rec, IsHandled);
        if IsHandled then
            exit;

        if Rec.Status <> Rec.Status::Released then begin
            ReleasePurchDoc.PerformManualRelease(Rec);
            Commit();
        end;
    end;
   ...

    [IntegrationEvent(false, false)]
    local procedure OnBeforePerformManualRelease(var PurchaseHeader: Record "Purchase Header"; var IsHandled: Boolean)
    begin
    end;

Additional context

Justification: we request the event since in BC22 it was introduced that in the actions Create Warehouse Shipment and Create Warehouse receipt the document is released automatically in case it was open. That conflicts now with existing custom logic, that the warehouse document is created already after the release of a document, leading to the issue that it is now tried two times to create the warehouse document. Internal work item: AB#544589

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