microsoft / ALAppExtensions

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

Suppress Windows open in Codeunit 442, Sales-Post Prepayments #26787

Open mvendert opened 4 days ago

mvendert commented 4 days ago

Describe the request

In de 'Code' procedure of SalesPostPrepayments a Windows.Open is performed unconditionally.

        OnCodeOnBeforeWindowOpen(SalesHeader, DocumentType);
        Window.Open(
          '#1#################################\\' +
          Text002 +
          Text004 +
          Text005 +
          Text006);
        Window.Update(1, StrSubstNo(UpdateTok, SelectStr(1 + DocumentType, Text019), SalesHeader."No."));

This should be made conditionally here and on the subsequent updates and closing of the window.

This can be accomplished by adding an 'if not GuiAllowed' to open the window conditionally, or add a new parameter to the OnCodeOnBeforeWindowsOpen like SuppressWindowOpen.

Additional context

We want to create an automatic import of Sales Orders (which can be prepaid). This needs to include the posting of the Prepayment Invoice either from the Job Queue of via an API-call.

We either want to be able to set a Boolean to prevent the opening/updating of the Window or an 'if GuiAllowed' test before the calls to the Dialog Window.