Dynamics 365 Business Central: How to ignore messages while validating (Hide Validation Dialog)

Dynamics 365 Business Central

Hi, Readers.
As you might know, when the field is validated in Business Central, you sometimes will get a message.
For example, when you edit the Shipment Date on the sales order line, if the Shipment Date is earlier than Work Date, a message will pop up automatically in standard and you need to click OK to confirm manually.

Shipment Date 03/25/21 is before work date 04/12/21

Yesterday someone asked me if we could hide this message. Why? If you just manually edit one line at a time, there is no problem. That’s a good message to remind us.

But if there’re a lot of data, or you have an Xmlport or report to import sales lines, this message will appear many times, and it may be very annoying to click OK for these messages.

For example, copy some sales lines from excel to Business Central.

Okay, how to ignore it?
First you can easily find this code in the standard source code of Table 37 “Sales Line”.

If this were the On-Premises version, we can just comment out this line of code. But can not do it in SaaS.

This time we need to use procedure SetHideValidationDialog(NewHideValidationDialog: Boolean).
True – hide
False – don’t hide

PS: This procedure is present in many tables by default.

For example:

Source Code:

tableextension 50100 "Sales Line Hide Dialog Ext" extends "Sales Line"
{
    fields
    {
        modify("Shipment Date")
        {
            trigger OnBeforeValidate()
            begin
                Rec.SetHideValidationDialog(true);
            end;
        }
    }
}

Test Video:

Update: How to ignore/hide “Order Date xx/xx/xx is earlier than the work date xx/xx/xx” message in Purchase Order

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL