microsoft / ALAppExtensions

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

[Event Change Request] Codeunit 7312 "Create Pick" - OnCreateWhseDocumentOnBeforeShowError #27034

Closed 1languste closed 1 month ago

1languste commented 1 month ago

Describe the request

I want to perform custom business logic insteat of the error message. Therefore, I request to add FirstWhseDocNo & CannotBeHandledReasons as a new Parameter to the OnCreateWhseDocumentOnBeforeShowError event:

procedure CreateWhseDocument(var FirstWhseDocNo: Code[20]; var LastWhseDocNo: Code[20]; ShowError: Boolean)
var
    OldNo: Code[20];
    OldSourceNo: Code[20];
    OldLocationCode: Code[10];
    OldBinCode: Code[20];
    OldZoneCode: Code[10];
    NoOfLines: Integer;
    NoOfSourceDoc: Integer;
    CreateNewHeader: Boolean;
    WhseDocCreated: Boolean;
    IsHandled: Boolean;
begin
    TempWarehouseActivityLine.Reset();
    if not TempWarehouseActivityLine.Find('-') then begin
        // NEW BEGIN
        OnCreateWhseDocumentOnBeforeShowError(ShowError, FirstWhseDocNo, CannotBeHandledReasons);
        // NEW END
        if ShowError then
            ShowErrorWhenNoTempWarehouseActivityLineExists();
        exit;
    end;
    // ...

[IntegrationEvent(false, false)]
local procedure OnCreateWhseDocumentOnBeforeShowError(var ShowError: Boolean; var FirstWhseDocNo: Code[20]; CannotBeHandledReasons: array[20] of Text)
begin
end;

Additional context

Based on my custom condition i want to message the DequeueCannotBeHandledReason and clear the FirstWhseDocNo instead of displaying the default error. Internal work item: AB#544558

JesperSchulz commented 1 month 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: 23054.