Dynamics 365 Business Central: How to hide/skip the Progress Window (Working on it…) for sales posting and purchase posting

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about how to hide/skip the Progress Window (Working on it…) for sales posting and purchase posting in Business Central.
This is a question I saw in the Dynamics 365 Community yesterday. More details: Dynamics Community Forum Thread Details. First, let’s take a look at what the Post Progress Window is.
For example, Choose Post on the Sales Order page.

Then you can see a Working on it… window. This is Post Progress Window, and this window allows you to see the details of postings in real time. On the other hand, without this window, you cannot see the progress of the posting, only wait for the posting to complete. So I personally don’t recommend hiding this window.

What’s the problem? In fact, in this page, we can cancel the posting process. Just click the “x” in the upper right corner.

If you cancel, all currently running processing tasks will be discarded. Are you sure you want to cancel?

Test video: Post -> Cancel -> Post

PS: Before Business Central 2022 wave 2 (BC21), this Working on it…(dialog window) had a “Cancel” button, but now moved to the corner as X aligning with the new Fluid design language.

Let’s get back to the topic, is there any way we can hide or skip this window? Unfortunately, the standard can’t do this and requires simple customization.
First of all, this windows is mainly done using Dialog Data Type. For example,

More details:
1. Progress indicator (Progress bar) in Dynamics 365 Business Central
2. How to create Message Box with Timer (Close a Message Box after several seconds)

This can also be found in the standard code. codeunit 80 “Sales-Post”:

Then, Microsoft prepared an event for us to deal with this problem.
Sales Post:

local procedure OnBeforePostSalesDoc(var SalesHeader: Record "Sales Header"; CommitIsSuppressed: Boolean; PreviewMode: Boolean; var HideProgressWindow: Boolean; var IsHandled: Boolean; var CalledBy: Integer)
    begin
    end;

Purchase Post:

    local procedure OnBeforePostPurchaseDoc(var PurchaseHeader: Record "Purchase Header"; PreviewMode: Boolean; CommitIsSupressed: Boolean; var HideProgressWindow: Boolean; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line"; var IsHandled: Boolean)
    begin
    end;

So, we can do it simply.

Test video:

Very simple! Give it a try!!!😁

Test code:

codeunit 50113 ProgressWindowHandler
{
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", OnBeforePostSalesDoc, '', false, false)]
    local procedure OnBeforePostSalesDoc(var HideProgressWindow: Boolean);
    begin
        HideProgressWindow := true;
    end;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnBeforePostPurchaseDoc, '', false, false)]
    local procedure OnBeforePostPurchaseDoc(var HideProgressWindow: Boolean);
    begin
        HideProgressWindow := true;
    end;
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL